/*************************************************************************************************************
 The MIT License

 Copyright (C) 2006-2019 David Dubbeldam, Sofia Calero, Thijs Vlugt, Donald E. Ellis, and Randall Q. Snurr.

     D.Dubbeldam@uva.nl            http://www.uva.nl/profiel/d/u/d.dubbeldam/d.dubbeldam.html
     scaldia@upo.es                http://www.upo.es/raspa/
     t.j.h.vlugt@tudelft.nl        http://homepage.tudelft.nl/v9k6y
     don-ellis@northwestern.edu    http://dvworld.northwestern.edu/
     snurr@northwestern.edu        http://zeolites.cqe.northwestern.edu/

 Permission is hereby granted, free of charge, to any person
 obtaining a copy of this software and associated documentation
 files (the "Software"), to deal in the Software without
 restriction, including without limitation the rights to use,
 copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the
 Software is furnished to do so, subject to the following
 conditions:

 The above copyright notice and this permission notice shall be
 included in all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************************/

// table data taken from many sources, e.g. Debeyer


#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <sys/stat.h>
#include "molecule.h"
#include "spectra.h"

#define NUMBER_OF_ATOM_DATA_ELEMENTS 132
#define NUMBER_OF_ANOMALOUS_SCATTERING_FACTORS 99
#define NUMBER_OF_XRAY_SCATTERING_FACTORS 216
#define NUMBER_OF_ELECTRONIC_SCATTERING_FACTORS 93
#define NUMBER_OF_NEUTRON_SCATTERING_FACTORS 87
#define NUMBER_OF_XRAY_SCATTERING_FACTORS95 214

typedef struct
{
  const char  *Label;
  REAL        a[4],b[4],c;
} XRAY_SCAT_STRUCT;

typedef struct
{
  const char  *Label;
  REAL        a[5],b[5],c;
} XRAY_SCAT_STRUCT95;


typedef struct
{
  const char   *Label;
  COMPLEX      ScatteringFactor[5];
} ANOM_SCAT_STRUCT;

typedef struct
{
  const char   *Label;
  REAL         a[4],b[4];
} ELECTRON_SCAT_STRUCT;

typedef struct
{
  const char   *Label;
  REAL       BondCohScattLength;
  REAL       BondCohScattLengthImag;
  REAL       AbsCrossSect;/* For 2200 m/s neutrons*/
} NEUTRON_SCAT_STRUCT;

typedef struct
{
  REAL Single;
  COMPLEX Doublet;
} XRAY_WAVELENGTH;

const XRAY_WAVELENGTH XrayWaveLengths[] =
{
  {2.2909,{2.28970,2.29361}},        // Cr
  {1.9373,{1.93604,1.93998}},        // Fe
  {1.5418,{1.54056,1.54439}},        // Cu
  {0.7107,{0.70930,0.71359}},        // Mo
  {0.5608,{0.55941,0.56380}}         // Ag
};

void SetDiffractionWaveLength(REAL Wavelength)
{
  if(Wavelength>0.0)
  {
    Diffraction.lambda=Wavelength;
    Diffraction.lambda2=0.0;
  }
  else
  {
    switch(Diffraction.lambda_type)
    {
      case DIFFRACTION_SINGLE:
        Diffraction.lambda=XrayWaveLengths[Diffraction.RadiationType].Single;
        Diffraction.lambda2=0.0;
        break;
      case DIFFRACTION_DOUBLET:
        Diffraction.lambda=XrayWaveLengths[Diffraction.RadiationType].Doublet.re;
        Diffraction.lambda2=XrayWaveLengths[Diffraction.RadiationType].Doublet.im;
        break;
      default:
        break;
    }
  }
}

typedef struct atom_data
{
  int number;
  char Element[5];
  char Name[32];
  REAL VDWRadius; // units of [A]
  REAL CovalentRadius[4]; // units of [A], 1st default, 2nd SP3, 3th SP2, 4th SP
  REAL Polarization;   // units of [A^3]
  REAL Mass;
} ATOM_DATA;

// Mass based on the Carbon 12 Standard
// CRC Handbook of Chemistry and Physics 88th edition (page 10 of 2643)
// http://en.wikipedia.org/wiki/Covalent_radius
// CRC Handbook of Chemistry and Physics 88th edition (page 1545 of 2643)
// CRC Handbook of Chemistry and Physics 88th edition (page 1881 of 2643)
const  ATOM_DATA AtomData[NUMBER_OF_ATOM_DATA_ELEMENTS] =
{
  {  1, "H",   "hydrogen",    1.10, {0.32,0.32,0.32,0.32}, 0.666793,    (1.00782503207*99.9885+2.0141017778*0.0115)/100.0},                             // H(1) 99.9885%, H(2) 0.0115%
  {  1, "D",   "deuterium",   1.10, {0.32,0.32,0.32,0.32}, 0.0     ,    2.0},
  {  2, "He",  "helium",      1.40, {0.37,0.37,0.37,0.37}, 0.2050522,   (4.00260325415*99.999866+3.0160492777*0.000134)/100.0},                         // He(4) 99.999866%, He(3) 0.000134%
  {  3, "Li",  "lithium",     1.82, {1.30,1.30,1.30,1.30}, 24.33,       (7.01600455*92.41+6.015122795*7.59)/100.0},                                     // Li(7) 92.41%, Li(6) 7.59%
  {  4, "Li+", "lithium",     1.82, {1.30,1.30,1.30,1.30}, 0.029,       (7.01600455*92.41+6.015122795*7.59)/100.0},                                     // Li(7) 92.41%, Li(6) 7.59%
  {  4, "Be",  "beryllium",   1.53, {0.99,0.99,0.99,0.99}, 5.60,        9.0121822},                                                                     // Be(9) 100.00%
  {  4, "Be2+","beryllium",   1.53, {0.99,0.99,0.99,0.99}, 0.008,       9.0121822},                                                                     // Be(9) 100.00%
  {  4, "Be3+","beryllium",   1.53, {0.99,0.99,0.99,0.99}, 0.003,       9.0121822},                                                                     // Be(9) 100.00%
  {  5, "B",   "boron",       1.92, {0.84,0.84,0.84,0.84}, 3.03,        (11.0093054*80.1+10.0129370*19.9)/100.0},                                       // B(11) 80.1%, B(10) 19.9%
  {  6, "C",   "carbon",      1.70, {0.75,0.77,0.73,0.69}, 1.76,        (12.0000000*98.93+13.0033548378*1.07)/100.0},                                   // C(12) 98.93%, C(13) 1.07%
  {  6, "C4+", "carbon",      1.70, {0.75,0.77,0.73,0.69}, 0.0013,      (12.0000000*98.93+13.0033548378*1.07)/100.0},                                   // C(12) 98.93%, C(13) 1.07%
  {  7, "N",   "nitrogen",    1.55, {0.71,0.71,0.71,0.71}, 1.10,        (14.0030740048*99.636+15.0001088982*0.364)/100.0},                              // N(14) 99.636%, N(15) 0.364%
  {  8, "O",   "oxygen",      1.52, {0.64,0.64,0.64,0.64}, 0.802,       (15.99491461956*99.757+17.9991610*0.205+16.99913170*0.038)/100.0},              // O(16) 99.757%, O(18) 0.205%, O(17) 0.038%
  {  8, "O2-", "oxygen",      1.52, {0.64,0.64,0.64,0.64}, 3.88,        (15.99491461956*99.757+17.9991610*0.205+16.99913170*0.038)/100.0},              // O(16) 99.757%, O(18) 0.205%, O(17) 0.038%
  {  9, "F",   "fluorine",    1.47, {0.60,0.60,0.60,0.60}, 0.557,       18.99840322},                                                                   // F(19) 100.00%
  {  9, "F-",  "fluorine",    1.47, {0.60,0.60,0.60,0.60}, 1.04,        18.99840322},                                                                   // F(19) 100.00%
  { 10, "Ne",  "neon",        1.54, {0.62,0.62,0.62,0.62}, 0.3956,      (19.9924401754*90.48+21.991385114*9.25+20.99384668*0.27)/100.0},                // Ne(20) 90.48%, Ne(22) 9.25%, Ne(21) 0.27%
  { 11, "Na",  "sodium",      2.27, {1.60,1.60,1.60,1.60}, 24.11,       22.9897692809},                                                                 // Na(23) 100.00%
  { 11, "Na+", "sodium",      2.27, {1.60,1.60,1.60,1.60}, 0.179,       22.9897692809},                                                                 // Na(23) 100.00%
  { 12, "Mg",  "magnesium",   1.73, {1.40,1.40,1.40,1.40}, 10.6,        (23.985041700*78.99+25.982592929*11.01+24.98583692*10.00)/100.0},               // Mg(24) 78.99%, Mg(26) 11.01%, Mg(25) 10.00%
  { 12, "Mg2+","magnesium",   1.73, {1.40,1.40,1.40,1.40}, 0.094,       (23.985041700*78.99+25.982592929*11.01+24.98583692*10.00)/100.0},               // Mg(24) 78.99%, Mg(26) 11.01%, Mg(25) 10.00%
  { 13, "Al",  "aluminium",   1.84, {1.24,1.24,1.24,1.24}, 6.8,         26.98153863},                                                                   // Al(27) 100.00%
  { 13, "Al3+","aluminium",   1.84, {1.24,1.24,1.24,1.24}, 0.052,       26.98153863},                                                                   // Al(27) 100.00%
  { 14, "Si",  "silicon",     2.10, {1.14,1.14,1.14,1.14}, 5.38,        (27.9769265325*92.223+28.976494700*4.685+29.97377017*3.092)/100.0},             // Si(28) 92.223%, Si(29) 4.685%, Si(30) 3.092%
  { 14, "Si4+","silicon",     2.10, {1.14,1.14,1.14,1.14}, 0.0165,      (27.9769265325*92.223+28.976494700*4.685+29.97377017*3.092)/100.0},             // Si(28) 92.223%, Si(29) 4.685%, Si(30) 3.092%
  { 15, "P",   "phosphorus",  1.80, {1.09,1.09,1.09,1.09}, 3.63,        30.97376163},                                                                   // P(31) 100.00%
  { 16, "S",   "sulphur",     1.80, {1.04,1.04,1.04,1.04}, 2.90,        (31.97207100*94.99+33.96786690*4.25+32.97145876*0.75+35.96708076*0.01)/100.0},  // S(32) 94.99%, S(34) 4.25%, S(33) 0.75%, S(36) 0.01%
  { 16, "S2-", "sulphur",     1.80, {1.04,1.04,1.04,1.04}, 10.2,        (31.97207100*94.99+33.96786690*4.25+32.97145876*0.75+35.96708076*0.01)/100.0},  // S(32) 94.99%, S(34) 4.25%, S(33) 0.75%, S(36) 0.01%
  { 17, "Cl",  "chlorine",    1.75, {1.00,1.00,1.00,1.00}, 2.18,        (34.96885268*75.76+36.96590259*24.24)/100.0},                                   // Cl(35) 75.76%, Cl(37) 24.24%
  { 17, "Cl-", "chlorine",    1.75, {1.00,1.00,1.00,1.00}, 3.66,        (34.96885268*75.76+36.96590259*24.24)/100.0},                                   // Cl(35) 75.76%, Cl(37) 24.24%
  { 18, "Ar",  "argon",       1.88, {1.01,1.01,1.01,1.01}, 1.6411,      (39.9623831225*99.6003+35.967545106*0.3365+37.9627324*0.0632)/100.0},           // Ar(40) 99.6003%, Ar(36) 0.3365%, Ar(38) 0.0632%
  { 19, "K",   "potassium",   2.75, {2.00,2.00,2.00,2.00}, 43.4,        (38.96370668*93.2581+40.96182576*6.7302+39.96399848*0.0117)/100.0},             // K(39) 93.2581%, K(41) 6.7302%, K(40) 0.0117%
  { 19, "K+",  "potassium",   2.75, {2.00,2.00,2.00,2.00}, 0.83,        (38.96370668*93.2581+40.96182576*6.7302+39.96399848*0.0117)/100.0},             // K(39) 93.2581%, K(41) 6.7302%, K(40) 0.0117%
  { 20, "Ca",  "calcium",     2.31, {1.74,1.74,1.74,1.74}, 22.8,        (39.96259098*96.941+43.9554818*2.086+41.95861801*0.647+47.952534*0.187+         // Ca(40) 96.941%, Ca(44) 2.086%, Ca(42) 0.646%, Ca(48) 0.187%,
                                                                         42.9587666*0.135+45.9536926*0.004)/100.0},                                     // Ca(43) 0.135%, Ca(46) 0.004%
  { 20, "Ca2+","calcium",     2.31, {1.74,1.74,1.74,1.74}, 0.47,        (39.96259098*96.941+43.9554818*2.086+41.95861801*0.647+47.952534*0.187+         // Ca(40) 96.941%, Ca(44) 2.086%, Ca(42) 0.646%, Ca(48) 0.187%,
                                                                         42.9587666*0.135+45.9536926*0.004)/100.0},                                     // Ca(43) 0.135%, Ca(46) 0.004%
  { 21, "Sc",  "scandium",    2.15, {1.59,1.59,1.59,1.59}, 17.8,        44.9559119},                                                                    // Sc(45) 100.00%
  { 21, "Sc3+","scandium",    2.15, {1.59,1.59,1.59,1.59}, 0.286,       44.9559119},                                                                    // Sc(45) 100.00%
  { 22, "Ti",  "titanium",    2.11, {1.48,1.48,1.48,1.48}, 14.6,        (47.9479463*73.72+45.9526316*8.25+46.9517631*7.44+                              // Ti(48) 73.72%, Ti(46) 8.25%, Ti(47) 7.44%,
                                                                         48.9478700*5.41+49.9447912*5.18)/100.0},                                       // Ti(49) 5.41%, Ti(50) 5.18%
  { 22, "Ti4+","titanium",    2.11, {1.48,1.48,1.48,1.48}, 0.185,       (47.9479463*73.72+45.9526316*8.25+46.9517631*7.44+                              // Ti(48) 73.72%, Ti(46) 8.25%, Ti(47) 7.44%,
                                                                         48.9478700*5.41+49.9447912*5.18)/100.0},                                       // Ti(49) 5.41%, Ti(50) 5.18%
  { 23, "V",   "vanadium",    2.07, {1.44,1.44,1.44,1.44}, 12.4,        (50.9439595*99.75+49.9471585*0.25)/100.0},                                      // V(51) 99.75%, V(50) 0.25%
  { 24, "Cr",  "chromium",    2.06, {1.30,1.30,1.30,1.30}, 11.6,        (51.9405075*83.789+52.9406494*9.501+49.9460442*4.345+53.9388804*2.365)/100.0},  // Cr(52) 83.789%, Cr(53) 9.501%, Cr(50) 4.345%, Cr(54) 2.365%
  { 25, "Mn",  "manganese",   2.05, {1.29,1.29,1.29,1.29}, 9.4,         54.9380451},                                                                    // Mn(55) 100.00%
  { 26, "Fe",  "iron",        2.04, {1.24,1.24,1.24,1.24}, 8.4,         (55.9349375*91.754+53.9396105*5.845+56.9353940*2.119+57.9332756*0.282)/100.0},  // Fe(56) 91.754%, Fe(54) 5.845%, Fe(57) 2.119%, Fe(58) 0.282%
  { 27, "Co",  "cobalt",      2.00, {1.18,1.18,1.18,1.18}, 7.5,         58.9331950},                                                                    // Co(59) 100.00%
  { 28, "Ni",  "nickel",      1.97, {1.17,1.17,1.17,1.17}, 6.8,         (57.9353429*68.0769+59.9307864*26.2231+61.9283451*3.6345+                       // Ni(58) 68.0769%, Ni(60) 26.2231%, Ni(62) 3.6345%,
                                                                         60.9310560*1.1399+63.9279660*0.9256)/100.0},                                   // Ni(61) 1.1399%, Ni(64) 0.9256%
  { 29, "Cu",  "copper",      1.96, {1.22,1.22,1.22,1.22}, 6.2,         (62.9295975*69.15+64.9277895*30.85)/100.0},                                     // Cu(63) 69.15%, Cu(65) 30.85%
  { 30, "Zn",  "zinc",        2.01, {1.20,1.20,1.20,1.20}, 5.75,        (63.9291422*48.268+65.9260334*27.975+67.9248442*19.024+                         // Zn(64) 48.268%, Zn(66) 27.975%, Zn(68) 19.024%,
                                                                         66.9271273*4.102+69.9253193*0.631)/100.0},                                     // Zn(67) 4.102%, Zn(70) 0.631%
  { 31, "Ga",  "gallium",     1.87, {1.23,1.23,1.23,1.23}, 8.12,        (68.9255736*60.108+70.9247013*39.892)/100.0},                                   // Ga(69) 60.108%, Ga(71) 39.892%
  { 32, "Ge",  "germanium",   2.11, {1.20,1.20,1.20,1.20}, 6.07,        (73.9211778*36.72+71.9220758*27.31+69.9242474*20.38+                            // Ge(74) 36.72%, Ge(72) 27.31%, Ge(70) 20.38%,
                                                                         75.9214026*7.83+72.9234589*7.76)/100.0},                                       // Ge(73) 7.83%, Ge(76) 7.76%
  { 33, "As",  "arsenic",     1.85, {1.20,1.20,1.20,1.20}, 4.31,        74.9215965},                                                                    // As(75)
  { 34, "Se",  "selenium",    1.90, {1.18,1.18,1.18,1.18}, 3.77,        (79.9165213*49.61+77.9173091*23.77+75.9192136*9.37+                             // Se(80) 49.61%, Se(78) 23.77%, Se(82) 9.37%,
                                                                         81.9166994*8.73+76.9199140*7.63+73.9224764*0.89)/100.0},                       // Se(76) 8.73%, Se(77) 7.63%, Se(74) 0.89%
  { 34, "Se2-","selenium",    1.90, {1.18,1.18,1.18,1.18}, 10.5,        (79.9165213*49.61+77.9173091*23.77+75.9192136*9.37+                             // Se(80) 49.61%, Se(78) 23.77%, Se(82) 9.37%,
                                                                         81.9166994*8.73+76.9199140*7.63+73.9224764*0.89)/100.0},                       // Se(76) 8.73%, Se(77) 7.63%, Se(74) 0.89%
  { 35, "Br",  "bromine",     1.85, {1.17,1.17,1.17,1.17}, 3.05,        (78.9183371*50.69+80.9162906*49.31)/100.0},                                     // Br(79) 50.69%, Br(81) 49.31%
  { 35, "Br-", "bromine",     1.85, {1.17,1.17,1.17,1.17}, 4.77,        (78.9183371*50.69+80.9162906*49.31)/100.0},                                     // Br(79) 50.69%, Br(81) 49.31%
  { 36, "Kr",  "krypton",     2.02, {1.16,1.16,1.16,1.16}, 2.4844,      (83.911507*56.987+85.91061073*17.279+81.9134836*11.593+                         // Kr(84) 56.987%, Kr((86) 17.279%, Kr((82) 11.593%,
                                                                         82.914136*11.50+79.9163790*2.286+77.9203648*0.355)/100.0},                     // Kr(83) 11.50%, Kr(80) 2.286%, Kr(78) 0.355%
  { 37, "Rb",  "rubidium",    3.03, {2.15,2.15,2.15,2.15}, 47.3,        (84.911789738*72.17+86.909180527*27.83)/100.0},                                 // Rb(85) 72.17%, Rb(87) 27.83%
  { 37, "Rb+", "rubidium",    3.03, {2.15,2.15,2.15,2.15}, 1.40,        (84.911789738*72.17+86.909180527*27.83)/100.0},                                 // Rb(85) 72.17%, Rb(87) 27.83%
  { 38, "Sr",  "strontium",   2.49, {1.90,1.90,1.90,1.90}, 27.6,        (87.9056121*82.58+85.9092602*9.86+86.9088771*7.00+83.913425*0.56)/100.0},       // Sr(88) 82.58%, Sr(86) 9.86%, Sr(87) 7.00%, Sr(84) 0.56%
  { 38, "Sr2+","strontium",   2.49, {1.90,1.90,1.90,1.90}, 0.86,        (87.9056121*82.58+85.9092602*9.86+86.9088771*7.00+83.913425*0.56)/100.0},       // Sr(88) 82.58%, Sr(86) 9.86%, Sr(87) 7.00%, Sr(84) 0.56%
  { 39, "Y",   "yttrium",     2.32, {1.76,1.76,1.76,1.76}, 22.7,        88.9058483},                                                                    // Y(89) 100.00%
  { 39, "Y3+", "yttrium",     2.32, {0.55,0.55,0.55,0.55}, 22.7,        88.9058483},                                                                    // Y(89) 100.00%
  { 40, "Zr",  "zirconium",   2.23, {1.64,1.64,1.64,1.64}, 17.9,        (89.9047044*51.45+93.9063152*17.38+91.9050408*17.15+                            // Zr(90) 51.45%, Zr(94) 17.38%, Zr(92) 17.15%,
                                                                         90.9056458*11.22+95.9082734*2.80)/100.0},                                      // Zr(91) 11.22%, Zr(96) 2.80%
  { 40, "Zr4+","zirconium",   2.23, {1.64,1.64,1.64,1.64}, 0.37,        (89.9047044*51.45+93.9063152*17.38+91.9050408*17.15+                            // Zr(90) 51.45%, Zr(94) 17.38%, Zr(92) 17.15%,
                                                                         90.9056458*11.22+95.9082734*2.80)/100.0},                                      // Zr(91) 11.22%, Zr(96) 2.80%
  { 41, "Nb",  "niobium",     2.18, {1.56,1.56,1.56,1.56}, 15.7,        92.9063781},                                                                    // Nb(93) 100.00%
  { 42, "Mo",  "molybdenum",  2.17, {1.46,1.46,1.46,1.46}, 12.8,        (97.9054082*24.19+95.9046795*16.68+94.9058421*15.90+91.906811*14.77+            // Mo(98) 24.19%, Mo(96) 16.68%, Mo(95) 15.90%, Mo(92) 14.77%,
                                                                         99.907477*9.67+96.9060215*9.56+93.9050883*9.23)/100.0},                        // Mo(100) 9.67%, Mo(97) 9.56%, Mo(94) 9.23%
  { 43, "Tc",  "technetium",  2.16, {1.38,1.38,1.38,1.38}, 11.4,         98.000},
  { 44, "Ru",  "ruthenium",   2.13, {1.36,1.36,1.36,1.36}, 9.6,        (101.9043493*31.55+103.905433*18.62+100.9055821*17.06+98.9059393*12.76+          // Ru(102) 31.55%, Ru(104) 18.62%, Ru(101) 17.06%, Ru(99) 12.76%
                                                                        99.9042195*12.60+95.907598*5.54+97.905287*1.87)/100.0},                         // Ru(100) 12.60%, Ru(96) 5.54%, Ru(98) 1.87%
  { 45, "Rh",  "rhodium",     2.10, {1.34,1.34,1.34,1.34}, 8.6,        102.905504},                                                                     // Rh(103) 100.00%
  { 46, "Pd",  "palladium",   2.10, {1.30,1.30,1.30,1.30}, 4.8,        (105.903486*27.33+107.903892*26.46+105.903486*22.33+                             // Pd(106) 27.33%, Pd(108) 26.46%, Pd(105) 22.33%,
                                                                        109.905153*11.72+103.904036*11.14+101.905609*1.02)/100.0},                      // Pd(110) 11.72%, Pd(104) 11.14%, Pd(102) 1.02%
  { 47, "Ag",  "silver",      2.11, {1.36,1.36,1.36,1.36}, 7.2,        (106.905097*51.839+108.904752*48.161)/100.0},                                    // Ag(107) 51.839%, Ag(109) 48.16i1%
  { 48, "Cd",  "cadmium",     2.18, {1.40,1.40,1.40,1.40}, 7.36,       (113.9033585*28.73+111.9027578*24.13+110.9041781*12.80+109.9030021*12.49+        // Cd(114) 28.73%, Cd(112) 24.13%, Cd(111) 12.80%, Cd(110) 12.49%,
                                                                        112.9044017*12.22+115.904756*7.49+105.906459*1.25+107.904184*0.89)/100.0},      // Cd(113) 12.22%, Cd(116) 7.49%, Cd(106) 1.25%, Cd(108) 0.89%
  { 49, "In",  "indium",      1.93, {1.42,1.42,1.42,1.42}, 10.2,       (114.903878*95.71+112.904058*4.29)/100.0},                                       // In(115) 95.71%, In(113) 4.29%
  { 50, "Sn",  "tin",         2.17, {1.40,1.40,1.40,1.40}, 7.7,        (119.9021947*32.58+117.901603*24.22+115.901741*14.54+118.903308*8.59+            // Sn(120) 32.58%, Sn(118) 24.22%, Sn(116) 14.54%, Sn(119) 8.59%,
                                                                        116.902952*7.68+123.9052739*5.79+121.9034390*4.63+111.904818*0.97+              // Sn(117) 7.68%, Sn(124) 5.79%, Sn(122) 4.63%, Sn(112) 0.97%,
                                                                        113.902779*0.66+114.903342*0.34)/100.0},                                        // Sn(114) 0.66%, Sn(115) 0.34%
  { 51, "Sb",  "antimony",    2.06, {1.40,1.40,1.40,1.40}, 6.6,        (120.9038157*57.21+122.9042140*42.79)/100.0},                                    // Sb(121) 57.21%, Sb(123) 42.79%
  { 52, "Te",  "tellurium",   2.06, {1.37,1.37,1.37,1.37}, 5.5,        (129.9062244*34.08+127.9044631*31.74+125.9033117*18.84+124.9044307*7.07+         // Te(130) 34.08%, Te(128) 31.74%, Te(126) 18.84%, Te(125) 7.07%,
                                                                        123.9028179*4.74+121.9030439*2.55+122.9042700*0.89+119.904020*0.09)/100.0},     // Te(124) 4.74%, Te(122) 2.55%, Te(123) 0.89%, Te(120) 0.096%
  { 52, "Te2-","tellurium",   2.06, {1.37,1.37,1.37,1.37}, 14.0,       (129.9062244*34.08+127.9044631*31.74+125.9033117*18.84+124.9044307*7.07+         // Te(130) 34.08%, Te(128) 31.74%, Te(126) 18.84%, Te(125) 7.07%,
                                                                        123.9028179*4.74+121.9030439*2.55+122.9042700*0.89+119.904020*0.09)/100.0},     // Te(124) 4.74%, Te(122) 2.55%, Te(123) 0.89%, Te(120) 0.096%
  { 53, "I",   "iodine",      1.98, {1.36,1.36,1.36,1.36}, 5.35,       126.904473},                                                                     // I(127) 100.00%
  { 53, "I-",  "iodine",      1.98, {1.36,1.36,1.36,1.36}, 7.1,        126.904473},                                                                     // I(127) 100.00%
  { 54, "Xe",  "xenon",       2.16, {1.36,1.36,1.36,1.36}, 4.044,      (131.9041535*26.9086+128.9047794*26.4006+130.9050824*21.2324+                    // Xe(132) 26.9086%, Xe(129) 26.4006%, Xe(131) 21.2324%,
                                                                        133.9053945*10.4357+135.907219*8.8573+129.9035080*4.0710+                       // Xe(134) 10.4357%, Xe(136) 8.8573%, Xe(130) 4.0710%,
                                                                        127.9035313*1.9102+123.9058930*0.0952+125.904274*0.0890)/100.0},                // Xe(128) 1.9102%, Xe(124) 0.0952%, Xe(126) 0.0890%
  { 55, "Cs",  "cesium",      3.43, {2.38,2.38,2.38,2.38}, 59.42,      132.905451933},                                                                  // Cs(133) 100.00%
  { 55, "Cs+", "cesium",      3.43, {2.38,2.38,2.38,2.38}, 2.42,       132.905451933},                                                                  // Cs(133) 100.00%
  { 56, "Ba",  "barium",      2.68, {2.06,2.06,2.06,2.06}, 39.7,       (137.9052472*71.698+136.9058274*11.232+135.9045759*7.854+134.9056886*6.592+      // Ba(138) 71.698%, Ba(137) 11.232%, Ba(136) 7.854%, Ba(135) 6.592%,
                                                                        133.9045084*2.417+129.9063208*0.106+131.9050613*0.101)/100.0},                  // Ba(134) 2.417%, Ba(130) 0.106%, Ba(132) 0.101%
  { 56, "Ba2+","barium",      2.68, {2.06,2.06,2.06,2.06}, 1.55,       (137.9052472*71.698+136.9058274*11.232+135.9045759*7.854+134.9056886*6.592+      // Ba(138) 71.698%, Ba(137) 11.232%, Ba(136) 7.854%, Ba(135) 6.592%,
                                                                        133.9045084*2.417+129.9063208*0.106+131.9050613*0.101)/100.0},                  // Ba(134) 2.417%, Ba(130) 0.106%, Ba(132) 0.101%
  { 57, "La",  "lanthanum",   2.43, {1.94,1.94,1.94,1.94}, 31.1,       (138.9063533*99.910+137.907112*0.090)/100.0},                                    // La(139) 99.910%, La(138) 0.090%
  { 57, "La3+","lanthanum",   2.43, {1.94,1.94,1.94,1.94}, 1.04,       (138.9063533*99.910+137.907112*0.090)/100.0},                                    // La(139) 99.910%, La(138) 0.090%
  { 58, "Ce",  "cerium",      2.42, {1.84,1.84,1.84,1.84}, 29.6,       (139.9054387*88.450+141.909244*11.114+137.905991*0.251+135.907172*0.185)/100.0}, // Ce(140) 88.450%, Ce(142) 11.114%, Ce(138) 0.251%, Ce(136) 0.185%
  { 58, "Ce4+","cerium",      2.42, {1.84,1.84,1.84,1.84}, 0.73,       (139.9054387*88.450+141.909244*11.114+137.905991*0.251+135.907172*0.185)/100.0}, // Ce(140) 88.450%, Ce(142) 11.114%, Ce(138) 0.251%, Ce(136) 0.185%
  { 59, "Pr",  "praseodymium",2.40, {1.90,1.90,1.90,1.90}, 28.2,       140.9076528},                                                                    // Pr(141) 100.00%
  { 60, "Nd",  "neodymium",   2.39, {1.88,1.88,1.88,1.88}, 31.4,       (141.9077233*27.2+143.9100873*23.8+145.9131169*17.2+142.9098143*12.2+            // Nd(142) 27.2%, Ns(144) 23.8%, Nd(146) 17.2%, Nd(143) 12.2%,
                                                                        144.9125736*8.3+147.916893*5.7+149.920891*5.6)/100.0},                          // Nd(145) 8.3%, Nd(148) 5.7%, Nd(150) 5.6%
  { 61, "Pm",  "promethium",  2.38, {1.86,1.86,1.86,1.86}, 30.1,       145.000},
  { 62, "Sm",  "samarium",    2.36, {1.85,1.85,1.85,1.85}, 28.8,       (151.9197324*26.75+153.9222093*22.75+146.9148979*14.99+148.9171847*13.82+        // Sm(158) 26.75%, Sm(154) 22.75%, Sm(147) 14.99%, Sm(149) 13.82%,
                                                                        147.9148227*11.24+149.9172755*7.38+143.911999*3.07)/100.0},                     // Sm(148) 11.24%, Sm(150) 7.38%, Sm(144) 3.07%
  { 63, "Eu",  "europium",    2.35, {1.83,1.83,1.83,1.83}, 27.7,       (152.9212303*52.19+150.9198502*47.81)/100.0},                                    // Eu(153) 52.19%, Eu(151) 47.81%
  { 64, "Gd",  "gadolinium",  2.34, {1.82,1.82,1.82,1.82}, 23.5,       (157.9241039*24.84+159.9270541*21.86+155.9221227*20.47+156.9239601*15.65+        // Gd(158) 24.84%, Gd(160) 21.86%, Gd(156) 20.47%, Gd(157) 15.65%,
                                                                        154.9226220*14.80+153.9208656*2.18+151.9197910*0.20)/100.0},                    // Gd(155) 14.80%, Gd(154) 2.18%, Gd(152) 0.20%
  { 65, "Tb",  "terbium",     2.33, {1.81,1.81,1.81,1.81}, 25.5,       158.9253468},                                                                    // Tb(159) 100.00%
  { 66, "Dy",  "dysprosium",  2.31, {1.80,1.80,1.80,1.80}, 24.5,       (163.9291748*28.260+161.9267984*25.475+162.9287312*24.896+160.9269334*18.889+    // Dy(164) 28.260%, Dy(162) 25.475%, Dy(163) 24.896%, Dy(161) 18.889%,
                                                                        159.9251975*2.329+157.924409*0.095+155.924283*0.056)/100.0},                    // Dy(160) 2.329%, Dy(158) 0.095%, Dy(156) 0.056%
  { 67, "Ho",  "holmium",     2.30, {1.79,1.79,1.79,1.79}, 23.6,       164.9303221},                                                                    // Ho(165) 100.00%
  { 68, "Er",  "erbium",      2.39, {1.77,1.77,1.77,1.77}, 22.7,       (165.9302931*33.503+167.9323702*26.978+166.9320482*22.869+                       // Er(166) 33.503%, Er(168) 26.978%, Er(167) 22.869%,
                                                                        169.9354643*14.910+163.929200*1.601+161.928778*0.139)/100.0},                   // Er(170) 14.910%, Er(164) 1.601%, Er(162) 0.139%
  { 69, "Tm",  "thulium",     2.27, {1.77,1.77,1.77,1.77}, 21.8,       168.9342133},                                                                    // Tm(169) 100.00%
  { 70, "Yb",  "ytterbium",   2.26, {1.78,1.78,1.78,1.78}, 21.0,       (173.9388621*31.83+171.9363815*21.83+172.9382108*16.13+170.9363258*14.28+        // Yb(174) 31.83%, Yb(172) 21.83%, Yb(173) 16.13%, Yb(171) 14.28%
                                                                        175.9425717*12.76+169.9347618*3.04+167.933897*0.13)/100.0},                     // Yb(176) 12.76%, Yb(170) 3.04%, Yb(168) 0.13%
  { 71, "Lu",  "lutetium",    2.24, {1.74,1.74,1.74,1.74}, 21.9,       (174.9407718*97.41+175.9426863*2.59)/100.0},                                     // Lu(175) 97.41%, Lu(176) 2.59%
  { 72, "Hf",  "hafnium",     2.23, {1.64,1.64,1.64,1.64}, 16.2,       (179.9465500*35.08+177.9436988*27.28+176.9432207*18.60+                          // Hf(180) 35.08%, Hf(178) 27.28%, Hf(177) 18.60%,
                                                                        178.9458161*13.62+175.9414086*5.26+173.940046*0.16)/100.0},                     // Hf(179) 13.62%, Hf(176) 5.26%, Hf(174) 0.16%
  { 73, "Ta",  "tantalum",    2.22, {1.58,1.58,1.58,1.58}, 13.1,       (180.9479958*99.988+179.9474648*0.012)},                                         // Ta(181) 99.988%, Ta(180) 0.012%
  { 74, "W",   "tungsten",    2.18, {1.50,1.50,1.50,1.50}, 11.1,       (183.9509312*30.64+185.9543641*28.43+181.9482042*26.50+                          // W(184) 30.64%, W(186) 28.43%, W((182) 26.50%
                                                                        182.9502230*14.31+179.946704*0.12)/100.0},                                      // W(183) 14.31%, W(180) 0.12%
  { 75, "Re",  "rhenium",     2.16, {1.41,1.41,1.41,1.41}, 9.7,        (186.9557531*62.60+184.9529550*37.40)/100.0},                                    // Re(187) 62.60%, Re(185) 37.40%
  { 76, "Os",  "osmium",      2.16, {1.36,1.36,1.36,1.36}, 8.5,        (191.9614807*40.78+189.9584470*26.26+188.9581475*16.15+187.9558382*13.24+        // Os(192) 40.78%, Os(190) 26.26%, Os(189) 16.15%, os(188) 13.24%
                                                                        186.9557505*1.96+185.9538382*1.59+183.9524891*0.02)/100.0},                     // Os(187) 1.96%, Os(186) 1.59%, Os(184) 0.02%
  { 77, "Ir",  "iridium",     2.13, {1.32,1.32,1.32,1.32}, 7.6,        (192.9629264*62.7+190.9605940*37.3)/100.0},                                      // Ir(193) 62.7%, Ir(191) 37.3%
  { 78, "Pt",  "platinum",    2.13, {1.30,1.30,1.30,1.30}, 6.5,        (194.9647911*33.832+193.9626803*32.967+195.9649515*25.242+                       // Pt(195) 33.832%, Pt(194) 32.967%, Pt(196) 25.242%,
                                                                        197.967893*7.163+191.9610380*0.782+189.959932*0.014)/100.0},                    // Pt(198) 7.163%, Pt(192) 0.782%, Pt(190) 0.014%
  { 79, "Au",  "gold",        2.14, {1.30,1.30,1.30,1.30}, 5.8,        196.9665687},                                                                    // Au(197) 100.00%
  { 80, "Hg",  "mercury",     2.23, {1.32,1.32,1.32,1.32}, 5.02,       (201.9706430*29.86+199.9683260*23.10+198.9682799*16.87+200.9703023*13.18+        // Hg(202) 29.86%, Hg(200) 23.10%, Hg(199) 16.87%, Hg(201) 13.18,
                                                                        197.9667690*9.97+203.9734939*6.87+195.965833*0.15)/100.0},                      // Hg(198) 9.97%, Hg(204) 6.87%, Hg(196) 0.15%
  { 81, "Tl",  "thallium",    1.96, {1.44,1.44,1.44,1.44}, 7.6,        (204.9744275*70.48+202.9723442*29.52)/100.0},                                    // Tl(205) 70.48%, Tl(203) 29.52%
  { 82, "Pb",  "lead",        2.02, {1.45,1.45,1.45,1.45}, 6.8,        (207.9766521*52.4+205.9744653*24.1+206.9758969*22.10+203.9730436*1.40)/100.0},   // Pb(208) 52.4%, Pb(206) 24.1%, Pb(207) 22.10%, Pb(204) 1.40%
  { 83, "Bi",  "bismuth",     2.07, {1.50,1.50,1.50,1.50}, 7.4,        208.9803987},                                                                    // Bi(209) 100.00%
  { 84, "Po",  "polonium",    1.97, {1.42,1.42,1.42,1.42}, 6.8,        209.000 },
  { 85, "At",  "astatine",    2.02, {1.48,1.48,1.48,1.48}, 6.0,        210.000 },
  { 86, "Rn",  "radon",       2.20, {1.46,1.46,1.46,1.46}, 5.3,        222.000 },
  { 87, "Fr",  "francium",    3.48, {2.42,2.42,2.42,2.42}, 48.60,      223.000 },
  { 88, "Ra",  "radium",      2.83, {2.21,2.21,2.21,2.21}, 38.3,       226.025 },
  { 89, "Ac",  "actinium",    2.47, {2.01,2.01,2.01,2.01}, 32.1,       227.028 },
  { 90, "Th",  "thorium",     2.45, {1.90,1.90,1.90,1.90}, 32.1,       232.0380553},                                                                    // Th(232) 100.00%
  { 91, "Pa",  "protactinium",2.43, {1.84,1.84,1.84,1.84}, 25.4,       231.035 },
  { 92, "U",   "uranium",     2.41, {1.83,1.83,1.83,1.83}, 24.9,       (238.0507882*99.2742+235.0439299*0.7204+234.0409521*0.0054)/100.0},              // U(238) 99.2742%, U(235) 0.7204%, U(234) 0.0054%
  { 93, "Np",  "neptunium",   2.39, {1.80,1.80,1.80,1.80}, 24.8,       237.048 },
  { 94, "Pu",  "plutonium",   2.43, {1.80,1.80,1.80,1.80}, 24.5,       244.000 },
  { 95, "Am",  "americium",   2.44, {1.73,1.73,1.73,1.73}, 23.3,       243.000 },
  { 96, "Cm",  "curium",      2.45, {1.68,1.68,1.68,1.68}, 23.0,       247.000 },
  { 97, "Bk",  "berkelium",   2.44, {1.68,1.68,1.68,1.68}, 22.7,       247.000 },
  { 98, "Cf",  "californium", 2.45, {1.68,1.68,1.68,1.68}, 20.5,       251.000 },
  { 99, "Es",  "einsteinium", 2.45, {1.65,1.65,1.65,1.65}, 19.7,       254.000 },
  {100, "Fm",  "fermium",     2.45, {1.67,1.67,1.67,1.67}, 23.8,       257.000 },
  {101, "Md",  "mendelevium", 2.46, {1.73,1.73,1.73,1.73}, 18.2,       258.000 },
  {102, "No",  "nobelium",    2.46, {1.76,1.76,1.76,1.76}, 17.5,       259.000 },
  {103, "Lr",  "lawrencium",  2.46, {1.61,1.61,1.61,1.61}, 0.0,        260.000 },
};

REAL GetAtomicMass(char *Name)
{
  int i;

  for(i=0;i<NUMBER_OF_ATOM_DATA_ELEMENTS;i++)
  {
    if(strncasecmp(AtomData[i].Element,Name,MAX2(strlen(AtomData[i].Element),strlen(Name)))==0)
       return AtomData[i].Mass;
  }
  return 0.0;
}

REAL GetCovalentRadius(char *Name)
{
  int i;

  for(i=0;i<NUMBER_OF_ATOM_DATA_ELEMENTS;i++)
  {
    if(strncasecmp(AtomData[i].Element,Name,MAX2(strlen(AtomData[i].Element),strlen(Name)))==0)
      return AtomData[i].CovalentRadius[0];
  }
  return 0.0;
}

REAL GetCovalentRadiusExtended(int type,char *Name)
{
  int i;
  int hybridization;

  for(i=0;i<NUMBER_OF_ATOM_DATA_ELEMENTS;i++)
  {
    if(strncasecmp(AtomData[i].Element,Name,MAX2(strlen(AtomData[i].Element),strlen(Name)))==0)
    {
      hybridization=PseudoAtoms[type].Hybridization;
      return AtomData[i].CovalentRadius[hybridization];
    }
  }
  return 0.0;
}

REAL GetAtomPolarization(char *Name)
{
  int i;

  for(i=0;i<NUMBER_OF_ATOM_DATA_ELEMENTS;i++)
  {
    if(strncasecmp(AtomData[i].Element,Name,MAX2(strlen(AtomData[i].Element),strlen(Name)))==0)
       return AtomData[i].Polarization;
  }
  return 0.0;
}



const XRAY_SCAT_STRUCT XrayScatteringFactors[NUMBER_OF_XRAY_SCATTERING_FACTORS] =
  {{"-",{0.0,0.0,0.0,0.0},{0.0,0.0,0.0,0.0},0.0},
   {"H",{0.493002,0.322912,0.140191,0.040810},{10.5109,26.1257,3.14236,57.7997},0.003038},
   {"H'",{0.489918,0.262003,0.196767,0.049879},{20.6593,7.74039,49.5519,2.20159},0.001305},
   {"D",{0.489918,0.262003,0.196767,0.049879},{20.6593,7.74039,49.5519,2.20159},0.001305},
   {"H1-",{0.897661,0.565616,0.415815,0.116973},{53.1368,15.1870,186.576,3.56709},0.002389},
   {"He",{0.873400,0.630900,0.311200,0.178000},{9.10370,3.35680,22.9276,0.982100},0.006400},
   {"Li",{1.12820,0.750800,0.617500,0.465300},{3.95460,1.05240,85.3905,168.261},0.037700},
   {"Li1+",{0.696800,0.788800,0.341400,0.156300},{4.62370,1.95570,0.631600,10.0953},0.016700},
   {"Be",{1.59190,1.12780,0.539100,0.702900},{43.6427,1.86230,103.483,0.542000},0.038500},
   {"Be2+",{6.26030,0.884900,0.799300,0.164700},{0.002700,0.831300,2.27580,5.11460},-6.1092},
   {"B",{2.05450,1.33260,1.09790,0.706800},{23.2185,1.02100,60.3498,0.140300},-0.19320},
   {"C",{2.31000,1.02000,1.58860,0.865000},{20.8439,10.2075,0.568700,51.6512},0.215600},
   {"Cval",{2.26069,1.56165,1.05075,0.839259},{22.6907,0.656665,9.75618,55.5949},0.286977},
   {"N",{12.2126,3.13220,2.01250,1.16630},{0.005700,9.89330,28.9975,0.582600},-11.529},
   {"O",{3.04850,2.28680,1.54630,0.867000},{13.2771,5.70110,0.323900,32.9089},0.250800},
   {"O1-",{4.19160,1.63969,1.52673,-20.307},{12.8573,4.17236,47.0179,-0.01404},21.9412},
   {"O2-",{3.75040,2.84294,1.54298,1.62091},{16.5151,6.59203,0.319201,43.3486},0.242060},
   {"F",{3.53920,2.64120,1.51700,1.02430},{10.2825,4.29440,0.261500,26.1476},0.277600},
   {"F1-",{3.63220,3.51057,1.26064,0.940706},{5.27756,14.7353,0.442258,47.3437},0.653396},
   {"Ne",{3.95530,3.11250,1.45460,1.12510},{8.40420,3.42620,0.230600,21.7184},0.351500},
   {"Na",{4.76260,3.17360,1.26740,1.11280},{3.28500,8.84220,0.313600,129.424},0.676000},
   {"Na1+",{3.25650,3.93620,1.39980,1.00320},{2.66710,6.11530,0.200100,14.0390},0.404000},
   {"Mg",{5.42040,2.17350,1.22690,2.30730},{2.82750,79.2611,0.380800,7.19370},0.858400},
   {"Mg2+",{3.49880,3.83780,1.32840,0.849700},{2.16760,4.75420,0.185000,10.1411},0.485300},
   {"Al",{6.42020,1.90020,1.59360,1.96460},{3.03870,0.742600,31.5472,85.0886},1.11510},
   {"Al3+",{4.17448,3.38760,1.20296,0.528137},{1.93816,4.14553,0.228753,8.28524},0.706786},
   {"Si",{6.29150,3.03530,1.98910,1.54100},{2.43860,32.3337,0.678500,81.6937},1.14070},
   {"Siv",{6.29150,3.03530,1.98910,1.54100},{2.43860,32.3337,0.678500,81.6937},1.14070},
   {"Sival",{5.66269,3.07164,2.62446,1.39320},{2.66520,38.6634,0.916946,93.5458},1.24707},
   {"Si4+",{4.43918,3.20345,1.19453,0.416530},{1.64167,3.43757,0.214900,6.65365},0.746297},
   {"P",{6.43450,4.17910,1.78000,1.49080},{1.90670,27.1570,0.526000,68.1645},1.11490},
   {"S",{6.90530,5.20340,1.43790,1.58630},{1.46790,22.2151,0.253600,56.1720},0.866900},
   {"Cl",{11.4604,7.19640,6.25560,1.64550},{0.010400,1.16620,18.5194,47.7784},-9.5574},
   {"Cl1-",{18.2915,7.20840,6.53370,2.33860},{0.006600,1.17170,19.5424,60.4486},-16.378},
   {"Ar",{7.48450,6.77230,0.653900,1.64420},{0.907200,14.8407,43.8983,33.3929},1.44450},
   {"K",{8.21860,7.43980,1.05190,0.865900},{12.7949,0.774800,213.187,41.6841},1.42280},
   {"K1+",{7.95780,7.49170,6.35900,1.19150},{12.6331,0.767400,-0.00200,31.9128},-4.9978},
   {"Ca",{8.62660,7.38730,1.58990,1.02110},{10.4421,0.659900,85.7484,178.437},1.37510},
   {"Ca2+",{15.6348,7.95180,8.43720,0.853700},{-0.00740,0.608900,10.3116,25.9905},-14.875},
   {"Sc",{9.18900,7.36790,1.64090,1.46800},{9.02130,0.572900,136.108,51.3531},1.33290},
   {"Sc3+",{13.4008,8.02730,1.65943,1.57936},{0.298540,7.96290,-0.28604,16.0662},-6.6667},
   {"Ti",{9.75950,7.35580,1.69910,1.90210},{7.85080,0.500000,35.6338,116.105},1.28070},
   {"Ti2+",{9.11423,7.62174,2.27930,0.087899},{7.52430,0.457585,19.5361,61.6558},0.897155},
   {"Ti3+",{17.7344,8.73816,5.25691,1.92134},{0.220610,7.04716,-0.15762,15.9768},-14.652},
   {"Ti4+",{19.5114,8.23473,2.01341,1.52080},{0.178847,6.67018,-0.29263,12.9464},-13.280},
   {"V",{10.2971,7.35110,2.07030,2.05710},{6.86570,0.438500,26.8938,102.478},1.21990},
   {"V2+",{10.1060,7.35410,2.28840,0.022300},{6.88180,0.440900,20.3004,115.122},1.22980},
   {"V3+",{9.43141,7.74190,2.15343,0.016865},{6.39535,0.383349,15.1908,63.9690},0.656565},
   {"V5+",{15.6887,8.14208,2.03081,-9.5760},{0.679003,5.40135,9.97278,0.940464},1.71430},
   {"Cr",{10.6406,7.35370,3.32400,1.49220},{6.10380,0.392000,20.2626,98.7399},1.18320},
   {"Cr2+",{9.54034,7.75090,3.58274,0.509107},{5.66078,0.344261,13.3075,32.4224},0.616898},
   {"Cr3+",{9.68090,7.81136,2.87603,0.113575},{5.59463,0.334393,12.8288,32.8761},0.518275},
   {"Mn",{11.2819,7.35730,3.01930,2.24410},{5.34090,0.343200,17.8674,83.7543},1.08960},
   {"Mn2+",{10.8061,7.36200,3.52680,0.218400},{5.27960,0.343500,14.3430,41.3235},1.08740},
   {"Mn3+",{9.84521,7.87194,3.56531,0.323613},{4.91797,0.294393,10.8171,24.1281},0.393974},
   {"Mn4+",{9.96253,7.97057,2.76067,0.054447},{4.84850,0.283303,10.4852,27.5730},0.251877},
   {"Fe",{11.7695,7.35730,3.52220,2.30450},{4.76110,0.307200,15.3535,76.8805},1.03690},
   {"Fe2+",{11.0424,7.37400,4.13460,0.439900},{4.65380,0.305300,12.0546,31.2809},1.00970},
   {"Fe3+",{11.1764,7.38630,3.39480,0.072400},{4.61470,0.300500,11.6729,38.5566},0.970700},
   {"Co",{12.2841,7.34090,4.00340,2.34880},{4.27910,0.278400,13.5359,71.1692},1.01180},
   {"Co2+",{11.2296,7.38830,4.73930,0.710800},{4.12310,0.272600,10.2443,25.6466},0.932400},
   {"Co3+",{10.3380,7.88173,4.76795,0.725591},{3.90969,0.238668,8.35583,18.3491},0.286667},
   {"Ni",{12.8376,7.29200,4.44380,2.38000},{3.87850,0.256500,12.1763,66.3421},1.03410},
   {"Ni2+",{11.4166,7.40050,5.34420,0.977300},{3.67660,0.244900,8.87300,22.1626},0.861400},
   {"Ni3+",{10.7806,7.75868,5.22746,0.847114},{3.54770,0.223140,7.64468,16.9673},0.386044},
   {"Cu",{13.3380,7.16760,5.61580,1.67350},{3.58280,0.247000,11.3966,64.8126},1.19100},
   {"Cu1+",{11.9475,7.35730,6.24550,1.55780},{3.36690,0.227400,8.66250,25.8487},0.89000},
   {"Cu2+",{11.8168,7.11181,5.78135,1.14523},{3.37484,0.244078,7.98760,19.8970},1.14431},
   {"Zn",{14.0743,7.03180,5.16520,2.41000},{3.26550,0.233300,10.3163,58.7097},1.30410},
   {"Zn2+",{11.9719,7.38620,6.46680,1.39400},{2.99460,0.203100,7.08260,18.0995},0.780700},
   {"Ga",{15.2354,6.70060,4.35910,2.96230},{3.06690,0.241200,10.7805,61.4135},1.71890},
   {"Ga3+",{12.6920,6.69883,6.06692,1.00660},{2.81262,0.227890,6.36441,14.4122},1.53545},
   {"Ge",{16.0816,6.37470,3.70680,3.68300},{2.85090,0.251600,11.4468,54.7625},2.13130},
   {"Ge4+",{12.9172,6.70003,6.06791,0.859041},{2.53718,0.205855,5.47913,11.6030},1.45572},
   {"As",{16.6723,6.07010,3.43130,4.27790},{2.63450,0.264700,12.9479,47.7972},2.53100},
   {"Se",{17.0006,5.81960,3.97310,4.35430},{2.40980,0.272600,15.2372,43.8163},2.84090},
   {"Br",{17.1789,5.23580,5.63770,3.98510},{2.17230,16.5796,0.260900,41.4328},2.95570},
   {"Br1-",{17.1718,6.33380,5.57540,3.72720},{2.20590,19.3345,0.287100,58.1535},3.17760},
   {"Kr",{17.3555,6.72860,5.54930,3.53750},{1.93840,16.5623,0.226100,39.3972},2.82500},
   {"Rb",{17.1784,9.64350,5.13990,1.52920},{1.78880,17.3151,0.274800,164.934},3.48730},
   {"Rb1+",{17.5816,7.65980,5.89810,2.78170},{1.71390,14.7957,0.160300,31.2087},2.07820},
   {"Sr",{17.5663,9.81840,5.42200,2.66940},{1.55640,14.0988,0.166400,132.376},2.50640},
   {"Sr2+",{18.0874,8.13730,2.56540,-34.193},{1.49070,12.6963,24.5651,-0.01380},41.4025},
   {"Y",{17.7760,10.2946,5.72629,3.26588},{1.40290,12.8006,0.125599,104.354},1.91213},
   {"Y3+",{17.9268,9.15310,1.76795,-33.108},{1.35417,11.2145,22.6599,-0.01319},40.2602},
   {"Zr",{17.8765,10.9480,5.41732,3.65721},{1.27618,11.9160,0.117622,87.6627},2.06929},
   {"Zr4+",{18.1668,10.0562,1.01118,-2.6479},{1.21480,10.1483,21.6054,-0.10276},9.41454},
   {"Nb",{17.6142,12.0144,4.04183,3.53346},{1.18865,11.7660,0.204785,69.7957},3.75591},
   {"Nb3+",{19.8812,18.0653,11.0177,1.94715},{0.019175,1.13305,10.1621,28.3389},-12.912},
   {"Nb5+",{17.9163,13.3417,10.7990,0.337905},{1.12446,0.028781,9.28206,25.7228},-6.3934},
   {"Mo",{3.70250,17.2356,12.8876,3.74290},{0.277200,1.09580,11.0040,61.6584},4.38750},
   {"Mo3+",{21.1664,18.2017,11.7423,2.30951},{0.014734,1.03031,9.53659,26.6307},-14.421},
   {"Mo5+",{21.0149,18.0992,11.4632,0.740625},{0.014345,1.02238,8.78809,23.3452},-14.316},
   {"Mo6+",{17.8871,11.1750,6.57891,0.000000},{1.03649,8.48061,0.058881,0.000000},0.344941},
   {"Tc",{19.1301,11.0948,4.64901,2.71263},{0.864132,8.14487,21.5707,86.8472},5.40428},
   {"Ru",{19.2674,12.9182,4.86337,1.56756},{0.808520,8.43467,24.7997,94.2928},5.37874},
   {"Ru3+",{18.5638,13.2885,9.32602,3.00964},{0.847329,8.37164,0.017662,22.8870},-3.1892},
   {"Ru4+",{18.5003,13.1787,4.71304,2.18535},{0.844582,8.12534,0.36495,20.8504},1.42357},
   {"Rh",{19.2957,14.3501,4.73425,1.28918},{0.751536,8.21758,25.8749,98.6062},5.32800},
   {"Rh3+",{18.8785,14.1259,3.32515,-6.1989},{0.764252,7.84438,21.2487,-0.01036},11.8678},
   {"Rh4+",{18.8545,13.9806,2.53464,-5.6526},{0.760825,7.62436,19.3317,-0.01020},11.2835},
   {"Pd",{19.3319,15.5017,5.29537,0.605844},{0.698655,7.98929,25.2052,76.8986},5.26593},
   {"Pd2+",{19.1701,15.2096,4.32234,0.000000},{0.696219,7.55573,22.5057,0.000000},5.29160},
   {"Pd4+",{19.2493,14.7900,2.89289,-7.9492},{0.683839,7.14833,17.9144,0.005127},13.0174},
   {"Ag",{19.2808,16.6885,4.80450,1.04630},{0.644600,7.47260,24.6605,99.8156},5.17900},
   {"Ag1+",{19.1812,15.9719,5.27475,0.357534},{0.646179,7.19123,21.7326,66.1147},5.21572},
   {"Ag2+",{19.1643,16.2456,4.37090,0.000000},{0.645643,7.18544,21.4072,0.000000},5.21404},
   {"Cd",{19.2214,17.6444,4.46100,1.60290},{0.594600,6.90890,24.7008,87.4825},5.06940},
   {"Cd2+",{19.1514,17.2535,4.47128,0.000000},{0.597922,6.80639,20.2521,0.000000},5.11937},
   {"In",{19.1624,18.5596,4.29480,2.03960},{0.547600,6.37760,25.8499,92.8029},4.93910},
   {"In3+",{19.1045,18.1108,3.78897,0.000000},{0.551522,6.32470,17.3595,0.000000},4.99635},
   {"Sn",{19.1889,19.1005,4.45850,2.46630},{5.83030,0.503100,26.8909,83.9571},4.78210},
   {"Sn2+",{19.1094,19.0548,4.56480,0.487000},{0.503600,5.83780,23.3752,62.2061},4.78610},
   {"Sn4+",{18.9333,19.7131,3.41820,0.019300},{5.76400,0.465500,14.0049,-0.75830},3.91820},
   {"Sb",{19.6418,19.0455,5.03710,2.68270},{5.30340,0.460700,27.9074,75.2825},4.59090},
   {"Sb3+",{18.9755,18.9330,5.10789,0.288753},{0.467196,5.22126,19.5902,55.5113},4.69626},
   {"Sb5+",{19.8685,19.0302,2.41253,0.000000},{5.44853,0.467973,14.1259,0.000000},4.69263},
   {"Te",{19.9644,19.0138,6.14487,2.52390},{4.81742,0.420885,28.5284,70.8403},4.35200},
   {"I",{20.1472,18.9949,7.51380,2.27350},{4.34700,0.381400,27.7660,66.8776},4.07120},
   {"I1-",{20.2332,18.9970,7.80690,2.88680},{4.35790,0.381500,29.5259,84.9304},4.07140},
   {"Xe",{20.2933,19.0298,8.97670,1.99000},{3.92820,0.344000,26.4659,64.2658},3.71180},
   {"Cs",{20.3892,19.1062,10.6620,1.49530},{3.56900,0.310700,24.3879,213.904},3.33520},
   {"Cs1+",{20.3524,19.1278,10.2821,0.961500},{3.55200,0.308600,23.7128,59.4565},3.27910},
   {"Ba",{20.3361,19.2970,10.8880,2.69590},{3.21600,0.275600,20.2073,167.202},2.77310},
   {"Ba2+",{20.1807,19.1136,10.9054,0.77634},{3.21367,0.283310,20.0558,51.7460},3.02902},
   {"La",{20.5780,19.5990,11.3727,3.28719},{2.94817,0.244475,18.7726,133.124},2.14678},
   {"La3+",{20.2489,19.3763,11.6323,0.336048},{2.92070,0.250698,17.8211,54.9453},2.40860},
   {"Ce",{21.1671,19.7695,11.8513,3.33049},{2.81219,0.226836,17.6083,127.113},1.86264},
   {"Ce3+",{20.8036,19.5590,11.9369,0.612376},{2.77691,0.231540,16.5408,43.1692},2.09013},
   {"Ce4+",{20.3235,19.8186,12.1233,0.144583},{2.65941,0.218850,15.7992,62.2355},1.59180},
   {"Pr",{22.0440,19.6697,12.3856,2.82428},{2.77393,0.222087,16.7669,143.644},2.05830},
   {"Pr3+",{21.3727,19.7491,12.1329,0.975180},{2.64520,0.214299,15.3230,36.4065},1.77132},
   {"Pr4+",{20.9413,20.0539,12.4668,0.296689},{2.54467,0.202481,14.8137,45.4643},1.24285},
   {"Nd",{22.6845,19.6847,12.7740,2.85137},{2.66248,0.210628,15.8850,137.903},1.98486},
   {"Nd3+",{21.9610,19.9339,12.1200,1.51031},{2.52722,0.199237,14.1783,30.8717},1.47588},
   {"Pm",{23.3405,19.6095,13.1235,2.87516},{2.56270,0.202088,15.1009,132.721},2.02876},
   {"Pm3+",{22.5527,20.1108,12.0671,2.07492},{2.41740,0.185769,13.1275,27.4491},1.19499},
   {"Sm",{24.0042,19.4258,13.4396,2.89604},{2.47274,0.196451,14.3996,128.007},2.20963},
   {"Sm3+",{23.1504,20.2599,11.9202,2.71488},{2.31641,0.174081,12.1571,24.8242},0.954586},
   {"Eu",{24.6274,19.0886,13.7603,2.92270},{2.38790,0.194200,13.7546,123.174},2.57450},
   {"Eu2+",{24.0063,19.9504,11.8034,3.87243},{2.27783,0.173530,11.6096,26.5156},1.36389},
   {"Eu3+",{23.7497,20.3745,11.8509,3.26503},{2.22258,0.163940,11.3110,22.9966},0.759344},
   {"Gd",{25.0709,19.0798,13.8518,3.54545},{2.25341,0.181951,12.9331,101.398},2.41960},
   {"Gd3+",{24.3466,20.4208,11.8708,3.71490},{2.13553,0.155525,10.5782,21.7029},0.645089},
   {"Tb",{25.8976,18.2185,14.3167,2.95354},{2.24256,0.196143,12.6648,115.362},3.58324},
   {"Tb3+",{24.9559,20.3271,12.2471,3.77300},{2.05601,0.149525,10.0499,21.2773},0.691967},
   {"Dy",{26.5070,17.6383,14.5596,2.96577},{2.18020,0.202172,12.1899,111.874},4.29728},
   {"Dy3+",{25.5395,20.2861,11.9812,4.50073},{1.98040,0.143384,9.34972,19.5810},0.689690},
   {"Ho",{26.9049,17.2940,14.5583,3.63837},{2.07051,0.197940,11.4407,92.6566},4.56796},
   {"Ho3+",{26.1296,20.0994,11.9788,4.93676},{1.91072,0.139358,8.80018,18.5908},0.852795},
   {"Er",{27.6563,16.4285,14.9779,2.98233},{2.07356,0.223545,11.3604,105.703},5.92046},
   {"Er3+",{26.7220,19.7748,12.1506,5.17379},{1.84659,0.137290,8.36225,17.8974},1.17613},
   {"Tm",{28.1819,15.8851,15.1542,2.98706},{2.02859,0.238849,10.9975,102.961},6.75621},
   {"Tm3+",{27.3083,19.3320,12.3339,5.38348},{1.78711,0.136974,7.96778,17.2922},1.63929},
   {"Yb",{28.6641,15.4345,15.3087,2.98963},{1.98890,0.257119,10.6647,100.417},7.56672},
   {"Yb2+",{28.1209,17.6817,13.3335,5.14657},{1.78503,0.159970,8.18304,20.3900},3.70983},
   {"Yb3+",{27.8917,18.7614,12.6072,5.47647},{1.73272,0.138790,7.64412,16.8153},2.26001},
   {"Lu",{28.9476,15.2208,15.1000,3.71601},{1.90182,9.98519,0.261033,84.3298},7.97628},
   {"Lu3+",{28.4628,18.1210,12.8429,5.59415},{1.68216,0.142292,7.33727,16.3535},2.97573},
   {"Hf",{29.1440,15.1726,14.7586,4.30013},{1.83262,9.59990,0.275116,72.0290},8.58154},
   {"Hf4+",{28.8131,18.4601,12.7285,5.59927},{1.59136,0.128903,6.76232,14.0366},2.39699},
   {"Ta",{29.2024,15.2293,14.5135,4.76492},{1.77333,9.37046,0.295977,63.3644},9.24354},
   {"Ta5+",{29.1587,18.8407,12.8268,5.38695},{1.50711,0.116741,6.31524,12.4244},1.78555},
   {"W",{29.0818,15.4300,14.4327,5.11982},{1.72029,9.22590,0.321703,57.0560},9.88750},
   {"W6+",{29.4936,19.3763,13.0544,5.06412},{1.42755,0.104621,5.93667,11.1972},1.01074},
   {"Re",{28.7621,15.7189,14.5564,5.44174},{1.67191,9.09227,0.350500,52.0861},10.4720},
   {"Os",{28.1894,16.1550,14.9305,5.67589},{1.62903,8.97948,0.382661,48.1647},11.0005},
   {"Os4+",{30.4190,15.2637,14.7458,5.06795},{1.37113,6.84706,0.165191,18.0030},6.49804},
   {"Ir",{27.3049,16.7296,15.6115,5.83377},{1.59279,8.86553,0.417916,45.0011},11.4722},
   {"Ir3+",{30.4156,15.8620,13.6145,5.82008},{1.34323,7.10909,0.204633,20.3254},8.27903},
   {"Ir4+",{30.7058,15.5512,14.2326,5.53672},{1.30923,6.71983,0.167252,17.4911},6.96824},
   {"Pt",{27.0059,17.7639,15.7131,5.78370},{1.51293,8.81174,0.424593,38.6103},11.6883},
   {"Pt2+",{29.8429,16.7224,13.2153,6.35234},{1.32927,7.38979,0.263297,22.9426},9.85329},
   {"Pt4+",{30.9612,15.9829,13.7348,5.92034},{1.24813,6.60834,0.168640,16.9392},7.39534},
   {"Au",{16.8819,18.5913,25.5582,5.86000},{0.461100,8.62160,1.48260,36.3956},12.0658},
   {"Au1+",{28.0109,17.8204,14.3359,6.58077},{1.35321,7.73950,0.356752,26.4043},11.2299},
   {"Au3+",{30.6886,16.9029,12.7801,6.52354},{1.21990,6.82872,0.212867,18.6590},9.09680},
   {"Hg",{20.6809,19.0417,21.6575,5.96760},{0.545000,8.44840,1.57290,38.3246},12.6089},
   {"Hg1+",{25.0853,18.4973,16.8883,6.48216},{1.39507,7.65105,0.443378,28.2262},12.0205},
   {"Hg2+",{29.5641,18.0600,12.8374,6.89912},{1.21152,7.05639,0.284738,20.7482},10.6268},
   {"Tl",{27.5446,19.1584,15.5380,5.52593},{0.655150,8.70751,1.96347,45.8149},13.1746},
   {"Tl1+",{21.3985,20.4723,18.7478,6.82847},{1.47110,0.517394,7.43463,28.8482},12.5258},
   {"Tl3+",{30.8695,18.3841,11.9328,7.00574},{1.10080,6.53852,0.219074,17.2114},9.80270},
   {"Pb",{31.0617,13.0637,18.4420,5.96960},{0.690200,2.35760,8.61800,47.2579},13.4118},
   {"Pb2+",{21.7886,19.5682,19.1406,7.01107},{1.33660,0.488383,6.77270,23.8132},12.4734},
   {"Pb4+",{32.1244,18.8003,12.0175,6.96886},{1.00566,6.10926,0.147041,14.7140},8.08428},
   {"Bi",{33.3689,12.9510,16.5877,6.46920},{0.704000,2.92380,8.79370,48.0093},13.5782},
   {"Bi3+",{21.8053,19.5026,19.1053,7.10295},{1.23560,6.24149,0.469999,20.3185},12.4711},
   {"Bi5+",{33.5364,25.0946,19.2497,6.91555},{0.916540,0.39042,5.71414,12.8285},-6.7994},
   {"Po",{34.6726,15.4733,13.1138,7.02588},{0.700999,3.55078,9.55642,47.0045},13.6770},
   {"At",{35.3163,19.0211,9.49887,7.42518},{0.685870,3.97458,11.3824,45.4715},13.7108},
   {"Rn",{35.5631,21.2816,8.00370,7.44330},{0.663100,4.06910,14.0422,44.2473},13.6905},
   {"Fr",{35.9299,23.0547,12.1439,2.11253},{0.646453,4.17619,23.1052,150.645},13.7247},
   {"Ra",{35.7630,22.9064,12.4739,3.21097},{0.616341,3.87135,19.9887,142.325},13.6211},
   {"Ra2+",{35.2150,21.6700,7.91342,7.65078},{0.604909,3.57670,12.6010,29.8436},13.5431},
   {"Ac",{35.6597,23.1032,12.5977,4.08655},{0.589092,3.65155,18.5990,117.020},13.5266},
   {"Ac3+",{35.1736,22.1112,8.19216,7.05545},{0.579689,3.41437,12.9187,25.9443},13.4637},
   {"Th",{35.5645,23.4219,12.7473,4.80703},{0.563359,3.46204,17.8309,99.1722},13.4314},
   {"Th4+",{35.1007,22.4418,9.78554,5.29444},{0.555054,3.24498,13.4661,23.9533},13.3760},
   {"Pa",{35.8847,23.2948,14.1891,4.17287},{0.547751,3.41519,16.9235,105.251},13.4287},
   {"U",{36.0228,23.4128,14.9491,4.18800},{0.529300,3.32530,16.0927,100.613},13.3966},
   {"U3+",{35.5747,22.5259,12.2165,5.37073},{0.520480,3.12293,12.7148,26.3394},13.3092},
   {"U4+",{35.3715,22.5326,12.0291,4.79840},{0.516598,3.05053,12.5723,23.4582},13.2671},
   {"U6+",{34.8509,22.7584,14.0099,1.21457},{0.507079,2.89030,13.1767,25.2017},13.1665},
   {"Np",{36.1874,23.5964,15.6402,4.18550},{0.511929,3.25396,15.3622,97.4908},13.3573},
   {"Np3+",{35.7074,22.6130,12.9898,5.43227},{0.502322,3.03807,12.1449,25.4928},13.2544},
   {"Np4+",{35.5103,22.5787,12.7766,4.92159},{0.498626,2.96627,11.9484,22.7502},13.2116},
   {"Np6+",{35.0136,22.7286,14.3884,1.75669},{0.489810,2.81099,12.3300,22.6581},13.1130},
   {"Pu",{36.5254,23.8083,16.7707,3.47947},{0.499384,3.26371,14.9455,105.980},13.3812},
   {"Pu3+",{35.8400,22.7169,13.5807,5.66016},{0.484938,2.96118,11.5331,24.3992},13.1991},
   {"Pu4+",{35.6493,22.6460,13.3595,5.18831},{0.481422,2.89020,11.3160,21.8301},13.1555},
   {"Pu6+",{35.1736,22.7181,14.7635,2.28678},{0.473204,2.73848,11.5530,20.9303},13.0582},
   {"Am",{36.6706,24.0992,17.3415,3.49331},{0.483629,3.20647,14.3136,102.273},13.3592},
   {"Cm",{36.6488,24.4096,17.3990,4.21665},{0.465154,3.08997,13.4346,88.4834},13.2887},
   {"Bk",{36.7881,24.7736,17.8919,4.23284},{0.451018,3.04619,12.8946,86.0030},13.2754},
   {"Cf",{36.9185,25.1995,18.3317,4.24391},{0.437533,3.00775,12.4044,83.7881},13.2674}
  };

/*
#Anomalous x-ray scattering factors (Cromer and Ibers IT vol 4 (1974))
#
#Data are f' and f" for Cr, Fe, Cu, Mo and Ag Kalpha
#***********************************************************************
#       Cr          Fe          Cu          Mo          Ag
#     f'    f''   f'    f''   f'    f''   f'    f''   f'    f''
*/

const ANOM_SCAT_STRUCT AnomousScatteringFactors[NUMBER_OF_ANOMALOUS_SCATTERING_FACTORS] =
   {{"-", {{0.000,0.000},{0.000,0.000},{0.000,0.000},{0.000,0.000},{0.000,0.000}}},
    {"H", {{0.000,0.000},{0.000,0.000},{0.000,0.000},{0.000,0.000},{0.000,0.000}}},
    {"He",{{0.000,0.000},{0.000,0.000},{0.000,0.000},{0.000,0.000},{0.000,0.000}}},
    {"Li",{{0.002,0.001},{0.002,0.001},{0.001,0.000},{0.000,0.000},{0.000,0.000}}},
    {"Be",{{0.008,0.003},{0.005,0.002},{0.003,0.001},{0.000,0.000},{-0.001,0.000}}},
    {"B", {{0.018,0.009},{0.013,0.007},{0.008,0.004},{0.000,0.001},{0.000,0.000}}},
    {"C", {{0.035,0.021},{0.026,0.015},{0.017,0.009},{0.002,0.002},{0.000,0.001}}},
    {"N", {{0.059,0.042},{0.044,0.029},{0.029,0.018},{0.004,0.003},{0.001,0.002}}},
    {"O", {{0.090,0.073},{0.069,0.052},{0.047,0.032},{0.008,0.006},{0.003,0.004}}},
    {"F", {{0.129,0.119},{0.100,0.085},{0.069,0.053},{0.014,0.010},{0.006,0.006}}},
    {"Ne",{{0.174,0.184},{0.138,0.132},{0.097,0.083},{0.021,0.016},{0.011,0.010}}},
    {"Na",{{0.223,0.270},{0.180,0.195},{0.129,0.124},{0.030,0.025},{0.016,0.015}}},
    {"Mg",{{0.272,0.381},{0.224,0.277},{0.165,0.177},{0.042,0.036},{0.023,0.022}}},
    {"Al",{{0.318,0.522},{0.269,0.381},{0.204,0.246},{0.056,0.052},{0.032,0.031}}},
    {"Si",{{0.355,0.693},{0.311,0.509},{0.244,0.330},{0.072,0.071},{0.042,0.043}}},
    {"P", {{0.377,0.900},{0.347,0.664},{0.283,0.434},{0.090,0.095},{0.055,0.058}}},
    {"S", {{0.374,1.142},{0.370,0.847},{0.319,0.557},{0.110,0.124},{0.068,0.076}}},
    {"Cl",{{0.335,1.423},{0.375,1.061},{0.348,0.702},{0.132,0.159},{0.084,0.099}}},
    {"Ar",{{0.243,1.747},{0.352,1.309},{0.366,0.872},{0.155,0.201},{0.101,0.125}}},
    {"K", {{0.070,2.110},{0.286,1.589},{0.365,1.066},{0.179,0.250},{0.118,0.156}}},
    {"Ca",{{-0.221,2.514},{0.163,1.904},{0.341,1.286},{0.203,0.306},{0.137,0.193}}},
    {"Sc",{{-0.717,2.968},{-0.038,2.256},{0.285,1.533},{0.226,0.372},{0.156,0.235}}},
    {"Ti",{{-1.683,3.470},{-0.357,2.643},{0.189,1.807},{0.248,0.446},{0.175,0.283}}},
    {"V", {{-3.841,0.459},{-0.896,3.070},{0.035,2.110},{0.267,0.530},{0.194,0.338}}},
    {"Cr",{{-2.161,0.548},{-1.973,3.533},{-0.198,2.443},{0.284,0.624},{0.213,0.399}}},
    {"Mn",{{-1.639,0.650},{-3.367,0.481},{-0.568,2.808},{0.295,0.729},{0.229,0.468}}},
    {"Fe",{{-1.339,0.764},{-2.095,0.566},{-1.179,3.204},{0.301,0.845},{0.244,0.545}}},
    {"Co",{{-1.124,0.893},{-1.623,0.662},{-2.464,3.608},{0.299,0.973},{0.256,0.630}}},
    {"Ni",{{-0.956,1.036},{-1.343,0.769},{-2.956,0.509},{0.285,1.113},{0.261,0.724}}},
    {"Cu",{{-0.795,1.196},{-1.129,0.888},{-2.019,0.589},{0.263,1.266},{0.265,0.826}}},
    {"Zn",{{-0.684,1.373},{-0.978,1.021},{-1.612,0.678},{0.222,1.431},{0.260,0.938}}},
    {"Ga",{{-0.570,1.569},{-0.841,1.168},{-1.354,0.777},{0.163,1.609},{0.249,1.059}}},
    {"Ge",{{-0.462,1.786},{-0.717,1.331},{-1.163,0.886},{0.081,1.801},{0.228,1.190}}},
    {"As",{{-0.365,2.022},{-0.607,1.508},{-1.011,1.006},{-0.030,2.007},{0.196,1.332}}},
    {"Se",{{-0.273,2.283},{-0.503,1.704},{-0.879,1.139},{-0.178,2.223},{0.152,1.481}}},
    {"Br",{{-0.198,2.563},{-0.413,1.916},{-0.767,1.283},{-0.374,2.456},{0.090,1.643}}},
    {"Kr",{{-0.130,2.872},{-0.328,2.149},{-0.665,1.439},{-0.652,2.713},{0.008,1.820}}},
    {"Rb",{{-0.082,3.201},{-0.256,2.398},{-0.574,1.608},{-1.044,2.973},{-0.099,2.003}}},
    {"Sr",{{-0.012,3.608},{-0.161,2.709},{-0.465,1.820},{-1.657,3.264},{-0.230,2.203}}},
    {"Y", {{0.006,4.002},{-0.106,3.009},{-0.386,2.025},{-2.951,3.542},{-0.406,2.411}}},
    {"Zr",{{0.007,4.422},{-0.061,3.329},{-0.314,2.245},{-2.965,0.560},{-0.639,2.630}}},
    {"Nb",{{-0.013,4.876},{-0.028,3.676},{-0.248,2.482},{-2.197,0.621},{-0.957,2.860}}},
    {"Mo",{{-0.063,5.353},{-0.012,4.043},{-0.191,2.735},{-1.825,0.688},{-1.416,3.103}}},
    {"Tc",{{-0.153,5.862},{-0.017,4.434},{-0.145,3.005},{-1.590,0.759},{-2.205,3.353}}},
    {"Ru",{{-0.270,6.406},{-0.039,4.854},{-0.105,3.296},{-1.420,0.836},{-5.524,3.651}}},
    {"Rh",{{-0.424,6.984},{-0.083,5.300},{-0.077,3.605},{-1.287,0.919},{-2.649,0.596}}},
    {"Pd",{{-0.639,7.594},{-0.157,5.773},{-0.059,3.934},{-1.177,1.007},{-2.128,0.654}}},
    {"Ag",{{-0.924,8.235},{-0.259,6.271},{-0.060,4.282},{-1.085,1.101},{-1.834,0.717}}},
    {"Cd",{{-1.303,8.912},{-0.416,6.800},{-0.079,4.653},{-1.005,1.202},{-1.637,0.783}}},
    {"In",{{-1.788,9.627},{-0.626,7.356},{-0.126,5.045},{-0.936,1.310},{-1.493,0.854}}},
    {"Sn",{{-2.4011,0.380},{-0.888,7.943},{-0.194,5.459},{-0.873,1.424},{-1.378,0.930}}},
    {"Sb",{{-3.1941,1.166},{-1.214,8.557},{-0.287,5.894},{-0.816,1.546},{-1.284,1.010}}},
    {"Te",{{-4.2671,1.995},{-1.630,9.203},{-0.418,6.352},{-0.772,1.675},{-1.212,1.096}}},
    {"I", {{-5.8521,2.850},{-2.147,9.885},{-0.579,6.835},{-0.726,1.812},{-1.144,1.187}}},
    {"Xe",{{-8.1331,1.933},{-2.8121,0.608},{-0.783,7.348},{-0.684,1.958},{-1.084,1.284}}},
    {"Cs",{{-10.74,12.92},{-3.65,11.38},{-1.02,7.90},{-0.64,2.12},{-1.03,1.39}}},
    {"Ba",{{-11.46,9.98},{-4.83,12.16},{-1.33,8.46},{-0.61,2.28},{-0.98,1.50}}},
    {"La",{{-12.14,3.57},{-6.68,12.94},{-1.72,9.04},{-0.59,2.45},{-0.94,1.62}}},
    {"Ce",{{-9.574,3.843},{-8.3881,1.953},{-2.170,9.648},{-0.564,2.632},{-0.904,1.735}}},
    {"Pr",{{-7.82,4.13},{-12.46,6.29},{-2.94,10.54},{-0.53,2.85},{-0.86,1.87}}},
    {"Nd",{{-7.49,4.43},{-11.02,9.87},{-3.43,10.93},{-0.54,3.02},{-0.84,2.00}}},
    {"Pm",{{-6.89,4.74},{-12.12,3.63},{-4.36,11.61},{-0.53,3.23},{-0.82,2.14}}},
    {"Sm",{{-6.429,5.073},{-9.616,3.883},{-5.6961,2.320},{-0.533,3.442},{-0.798,2.281}}},
    {"Eu",{{-6.050,5.416},{-8.352,4.149},{-7.7181,1.276},{-0.542,3.669},{-0.782,2.435}}},
    {"Gd",{{-5.779,5.773},{-7.565,4.427},{-9.2421,1.946},{-0.564,3.904},{-0.774,2.595}}},
    {"Tb",{{-5.525,6.153},{-6.980,4.721},{-9.498,9.242},{-0.591,4.151},{-0.767,2.764}}},
    {"Dy",{{-5.25,6.55},{-6.49,5.03},{-10.42,9.75},{-0.62,4.41},{-0.76,2.94}}},
    {"Ho",{{-5.04,6.96},{-6.11,5.34},{-12.26,3.70},{-0.67,4.68},{-0.77,3.12}}},
    {"Er",{{-4.878,7.387},{-5.810,5.675},{-9.733,3.937},{-0.723,4.958},{-0.773,3.316}}},
    {"Tm",{{-4.753,7.833},{-5.565,6.022},{-8.488,4.181},{-0.795,5.248},{-0.790,3.515}}},
    {"Yb",{{-4.652,8.291},{-5.361,6.378},{-7.701,4.432},{-0.884,5.548},{-0.815,3.723}}},
    {"Lu",{{-4.580,8.759},{-5.190,6.745},{-7.133,4.693},{-0.988,5.858},{-0.847,3.937}}},
    {"Hf",{{-4.592,9.277},{-5.088,7.148},{-6.715,4.977},{-1.118,6.185},{-0.890,4.164}}},
    {"Ta",{{-4.540,9.811},{-4.948,7.565},{-6.351,5.271},{-1.258,6.523},{-0.937,4.399}}},
    {"W", {{-4.4991,0.364},{-4.823,7.996},{-6.048,5.577},{-1.421,6.872},{-0.993,4.643}}},
    {"Re",{{-4.4831,0.929},{-4.719,8.439},{-5.790,5.891},{-1.598,7.232},{-1.048,4.894}}},
    {"Os",{{-4.5031,1.520},{-4.647,8.903},{-5.581,6.221},{-1.816,7.605},{-1.127,5.156}}},
    {"Ir",{{-4.5271,2.140},{-4.578,9.389},{-5.391,6.566},{-2.066,7.990},{-1.216,5.427}}},
    {"Pt",{{-4.5841,2.787},{-4.535,9.895},{-5.233,6.925},{-2.352,8.388},{-1.319,5.708}}},
    {"Au",{{-4.6681,3.451},{-4.5101,0.418},{-5.096,7.297},{-2.688,8.798},{-1.438,5.998}}},
    {"Hg",{{-4.8031,4.143},{-4.5231,0.963},{-4.990,7.686},{-3.084,9.223},{-1.576,6.299}}},
    {"Tl",{{-4.9451,4.860},{-4.5321,1.528},{-4.883,8.089},{-3.556,9.659},{-1.730,6.610}}},
    {"Pb",{{-5.1611,5.595},{-4.5961,2.108},{-4.818,8.505},{-4.1331,0.102},{-1.910,6.930}}},
    {"Bi",{{-5.4201,6.341},{-4.6881,2.700},{-4.776,8.930},{-4.8611,0.559},{-2.116,7.258}}},
    {"Po",{{-5.7421,7.139},{-4.8171,3.331},{-4.756,9.383},{-5.9241,1.042},{-2.353,7.600}}},
    {"At",{{-6.1321,7.942},{-4.9921,3.969},{-4.772,9.843},{-7.444,9.961},{-2.630,7.949}}},
    {"Rn",{{-6.5451,8.775},{-5.1731,4.629},{-4.7871,0.317},{-8.8621,0.403},{-2.932,8.307}}},
    {"Fr",{{-7.0521,9.615},{-5.4021,5.299},{-4.8331,0.803},{-7.912,7.754},{-3.285,8.674}}},
    {"Ra",{{-7.6142,0.461},{-5.6591,5.977},{-4.8981,1.296},{-7.620,8.105},{-3.702,9.047}}},
    {"Ac",{{-8.3182,1.327},{-5.9761,6.668},{-4.9941,1.799},{-7.725,8.472},{-4.192,9.428}}},
    {"Th",{{-9.1502,2.240},{-6.3131,7.397},{-5.0911,2.330},{-8.127,8.870},{-4.784,9.819}}},
    {"Pa",{{-10.38,23.16},{-6.70,18.14},{-5.22,12.87},{-8.96,9.28},{-5.56,10.23}}},
    {"U", {{-10.93,23.12},{-7.13,18.88},{-5.36,13.41},{-10.67,9.65},{-6.74,10.64}}},
    {"Np",{{-12.15,24.10},{-7.62,19.64},{-5.53,13.97},{-11.16,4.15},{-7.84,9.57}}},
    {"Pu",{{-12.28,23.66},{-8.19,20.43},{-5.71,14.54},{-9.73,4.33},{-8.47,7.00}}},
    {"Am",{{-12.77,24.61},{-8.87,21.17},{-5.93,15.09},{-8.93,4.51},{-7.70,7.30}}},
    {"Cm",{{-13.51,25.54},{-9.74,21.90},{-6.18,15.63},{-8.42,4.70},{-7.39,7.59}}},
    {"Bk",{{-14.83,26.80},{-10.54,21.94},{-6.50,16.32},{-7.99,4.91},{-7.49,7.93}}},
    {"Cf",{{-16.27,27.90},{-11.64,22.79},{-6.80,16.93},{-7.68,5.11},{-7.64,8.25}}}};


// Electron Scattering Factors.
// Doyle and Turner Acta Cryst. A24 (68) 390-7
const ELECTRON_SCAT_STRUCT ElectronScatteringFactors[NUMBER_OF_ELECTRONIC_SCATTERING_FACTORS] =
{
  {"-",{0.0,0.0,0.0,0.0},{0.0,0.0,0.0,0.0}},
  {"H",{0.0,0.0,0.0,0.0},{0.0,0.0,0.0,0.0}},
  {"He",{0.0906,0.1814,0.1095,0.0362},{18.1834,6.2109,1.8026,0.2844}},
  {"Li",{1.6108,1.2460,0.3257,0.0986},{107.6384,30.4795,4.5331,0.4951}},
  {"Be",{1.2498,1.3335,0.3603,0.1055},{60.8042,18.5914,3.6534,0.4157}},
  {"B",{0.9446,1.3120,0.4188,0.1159},{46.4438,14.1778,3.2228,0.3767}},
  {"C",{0.7307,1.1951,0.4563,0.1247},{35.9951,11.2966,2.8139,0.3456}},
  {"N",{0.5717,1.0425,0.4647,0.1311},{28.8465,9.0542,2.4213,0.3167}},
  {"O",{0.4548,0.9173,0.4719,0.1384},{23.7803,7.6220,2.1440,0.2959}},
  {"F",{0.3686,0.8109,0.4751,0.1459},{20.2390,6.6093,1.9310,0.2793}},
  {"Ne",{0.3025,0.7202,0.4751,0.1534},{17.6396,5.8604,1.7623,0.2656}},
  {"Na",{2.2406,1.3326,0.9070,0.2863},{108.0039,24.5047,3.3914,0.4346}},
  {"Mg",{2.2682,1.8025,0.8394,0.2892},{73.6704,20.1749,3.0181,0.4046}},
  {"Al",{2.2756,2.4280,0.8578,0.3166},{72.3220,19.7729,3.0799,0.4076}},
  {"Si",{2.1293,2.5333,0.8349,0.3216},{57.7748,16.4756,2.8796,0.3860}},
  {"P",{1.8882,2.4685,0.8046,0.3204},{44.8756,13.5383,2.6424,0.3608}},
  {"S",{1.6591,2.3863,0.7899,0.3208},{36.6500,11.4881,2.4686,0.3403}},
  {"Cl",{1.4524,2.2926,0.7874,0.3217},{30.9352,9.9798,2.3336,0.3228}},
  {"Ar",{1.2736,2.1894,0.7927,0.3225},{26.6823,8.8130,2.2186,0.3071}},
  {"K",{3.9507,2.5452,1.9795,0.4817},{137.0748,22.4017,4.5319,0.4340}},
  {"Ca",{4.4696,2.9708,1.9696,0.4818},{99.5228,22.6958,4.1954,0.4165}},
  {"Sc",{3.9659,2.9169,1.9254,0.4802},{88.9597,20.6061,3.8557,0.3988}},
  {"Ti",{3.5653,2.8181,1.8930,0.4825},{81.9821,19.0486,3.5904,0.3855}},
  {"V",{3.2449,2.6978,1.8597,0.4864},{76.3789,17.7262,3.3632,0.3743}},
  {"Cr",{2.3066,2.3339,1.8226,0.4901},{78.4051,15.7851,3.1566,0.3636}},
  {"Mn",{2.7467,2.4556,1.7923,0.4984},{67.7862,15.6743,2.9998,0.3569}},
  {"Fe",{2.5440,2.3434,1.7588,0.5062},{64.4244,14.8806,2.8539,0.3502}},
  {"Co",{2.3668,2.2361,1.7243,0.5148},{61.4306,14.1798,2.7247,0.3442}},
  {"Ni",{2.2104,2.1342,1.6891,0.5238},{58.7267,13.5530,2.6094,0.3388}},
  {"Cu",{1.5792,1.8197,1.6576,0.5323},{62.9403,12.4527,2.5042,0.3331}},
  {"Zn",{1.9418,1.9501,1.6192,0.5434},{54.1621,12.5177,2.4164,0.3295}},
  {"Ga",{2.3205,2.4855,1.6879,0.5992},{65.6019,15.4577,2.5806,0.3510}},
  {"Ge",{2.4467,2.7015,1.6157,0.6009},{55.8930,14.3930,2.4461,0.3415}},
  {"As",{2.3989,2.7898,1.5288,0.5936},{45.7179,12.8166,2.2799,0.3277}},
  {"Se",{2.2980,2.8541,1.4555,0.5895},{38.8296,11.5359,2.1463,0.3163}},
  {"Br",{2.1659,2.9037,1.3951,0.5886},{33.8987,10.4996,2.0413,0.3070}},
  {"Kr",{2.0338,2.9271,1.3425,0.5888},{29.9992,9.5977,1.9520,0.2986}},
  {"Rb",{4.7760,3.8588,2.2339,0.8683},{140.7821,18.9910,3.7010,0.4194}},
  {"Sr",{5.8478,4.0026,2.3420,0.8795},{104.9721,19.3666,3.7368,0.4142}},
  {"Y",{0,0,0,0},{0,0,0,0}},
  {"Zr",{0,0,0,0},{0,0,0,0}},
  {"Nb",{0,0,0,0},{0,0,0,0}},
  {"Mo",{3.1199,3.9061,2.3615,0.8504},{72.4642,14.6424,3.2370,0.3662}},
  {"Tc",{0,0,0,0},{0,0,0,0}},
  {"Ru",{0,0,0,0},{0,0,0,0}},
  {"Rh",{0,0,0,0},{0,0,0,0}},
  {"Pd",{0,0,0,0},{0,0,0,0}},
  {"Ag",{2.0355,3.2716,2.5105,0.8372},{61.4970,11.8237,2.8456,0.3271}},
  {"Cd",{2.5737,3.2586,2.5468,0.8379},{55.6752,11.8376,2.7842,0.3217}},
  {"In",{3.1528,3.5565,2.8180,0.8842},{66.6492,14.4494,2.9758,0.3345}},
  {"Sn",{3.4495,3.7349,2.7779,0.8786},{59.1042,14.1787,2.8548,0.3270}},
  {"Sb",{3.5644,3.8437,2.6866,0.8638},{50.4869,13.3156,2.6909,0.3161}},
  {"Te",{4.7850,3.6880,1.5000,0.0000},{27.9990,5.0830,0.5810,0.0000}},
  {"I",{3.4728,4.0602,2.5215,0.8398},{39.4411,11.8161,2.4148,0.2976}},
  {"Xe",{3.3656,4.1468,2.4430,0.8293},{35.5094,11.1170,2.2940,0.2892}},
  {"Cs",{6.0620,5.9861,3.3033,1.0958},{155.8336,19.6951,3.3354,0.3793}},
  {"Ba",{7.8212,6.0040,3.2803,1.1030},{117.6575,18.7782,3.2634,0.3760}},
  {"La",{0,0,0,0},{0,0,0,0}},
  {"Ce",{0,0,0,0},{0,0,0,0}},
  {"Pr",{0,0,0,0},{0,0,0,0}},
  {"Nd",{0,0,0,0},{0,0,0,0}},
  {"Pm",{0,0,0,0},{0,0,0,0}},
  {"Sm",{0,0,0,0},{0,0,0,0}},
  {"Eu",{6.2667,4.8440,3.2023,1.2009},{100.2983,16.0662,2.9803,0.3674}},
  {"Gd",{0,0,0,0},{0,0,0,0}},
  {"Tb",{0,0,0,0},{0,0,0,0}},
  {"Dy",{0,0,0,0},{0,0,0,0}},
  {"Ho",{0,0,0,0},{0,0,0,0}},
  {"Er",{0,0,0,0},{0,0,0,0}},
  {"Tm",{0,0,0,0},{0,0,0,0}},
  {"Yb",{0,0,0,0},{0,0,0,0}},
  {"Lu",{0,0,0,0},{0,0,0,0}},
  {"Hf",{0,0,0,0},{0,0,0,0}},
  {"Ta",{0,0,0,0},{0,0,0,0}},
  {"W",{0,0,0,0},{0,0,0,0}},
  {"Re",{0,0,0,0},{0,0,0,0}},
  {"Os",{0,0,0,0},{0,0,0,0}},
  {"Ir",{0,0,0,0},{0,0,0,0}},
  {"Pt",{0,0,0,0},{0,0,0,0}},
  {"Au",{2.3880,4.2259,2.6886,1.2551},{42.8656,9.7430,2.2641,0.3067}},
  {"Hg",{2.6817,4.2414,2.7549,1.2708},{42.8217,9.8557,2.2951,0.3067}},
  {"Tl",{0,0,0,0},{0,0,0,0}},
  {"Pb",{3.5099,4.5523,3.1539,1.3591},{52.9141,11.8840,2.5713,0.3205}},
  {"Bi",{3.8412,4.6794,3.1924,1.3625},{50.2608,11.9988,2.5598,0.3177}},
  {"Po",{0,0,0,0},{0,0,0,0}},
  {"At",{0,0,0,0},{0,0,0,0}},
  {"Ra",{4.0779,4.9778,3.0955,1.3259},{38.4058,11.0204,2.3549,0.2991}},
  {"Fr",{0,0,0,0},{0,0,0,0}},
  {"Ra",{0,0,0,0},{0,0,0,0}},
  {"Ac",{0,0,0,0},{0,0,0,0}},
  {"Th",{0,0,0,0},{0,0,0,0}},
  {"Pa",{0,0,0,0},{0,0,0,0}},
  {"U",{6.7668,6.7287,4.0135,1.5607},{85.9510,15.6415,2.9364,0.3348}}};


const NEUTRON_SCAT_STRUCT NeutronScatteringFactors[NUMBER_OF_NEUTRON_SCATTERING_FACTORS]=
{
  {"-",0.0,0.0,0.0},
  {"H",-3.7390,0.0,0.3326},
  {"D",6.671,0.0,0.000519},
  {"He",3.26,0.0,0.00747},
  {"Li",-1.90,0.0,70.5},
  {"Be",7.79,0.0,0.0076},
  {"B",5.30,-0.213,767.0},
  {"C",6.6460,0.0,0.0035},
  {"N",9.36,0.0,1.9},
  {"O",5.803,0.0,0.00019},
  {"F",5.654,0.0,0.0096},
  {"Ne",4.566,0.0,0.039},
  {"Na",3.63,0.0,0.53},
  {"Mg",5.375,0.0,0.063},
  {"Al",3.449,0.0,0.231},
  {"Si",4.1491,0.0,0.171},
  {"P",5.13,0.0,0.172},
  {"S",2.847,0.0,0.53},
  {"Cl",9.5770,0.0,33.5},
  {"Ar",1.909,0.0,0.675},
  {"K",3.67,0.0,2.1},
  {"Ca",4.70,0.0,0.43},
  {"Sc",12.29,0.0,27.5},
  {"Ti",-3.438,0.0,6.09},
  {"V",-0.3824,0.0,5.08},
  {"Cr",3.635,0.0,3.05},
  {"Mn",-3.73,0.0,13.3},
  {"Fe",9.45,0.0,2.56},
  {"Co",2.49,0.0,37.18},
  {"Ni",10.3,0.0,4.49},
  {"Cu",7.718,0.0,3.78},
  {"Zn",5.680,0.0,1.11},
  {"Ga",7.288,0.0,2.75},
  {"Ge",8.185,0.0,2.2},
  {"As",6.58,0.0,4.5},
  {"Se",7.970,0.0,11.7},
  {"Br",6.795,0.0,6.9},
  {"Kr",7.81,0.0,25.},
  {"Rb",7.09,0.0,0.38},
  {"Sr",7.02,0.0,1.28},
  {"Y",7.75,0.0,1.28},
  {"Zr",7.16,0.0,0.185},
  {"Nb",7.054,0.0,1.15},
  {"Mo",6.715,0.0,2.48},
  {"Tc",6.8,0.0,20.},
  {"Ru",7.03,0.0,2.56},
  {"Rh",5.88,0.0,144.8},
  {"Pd",5.91,0.0,6.9},
  {"Ag",5.922,0.0,63.3},
  {"Cd",4.87,-0.70,2520.},
  {"In",4.065,-0.0539,193.8},
  {"Sn",6.225,0.0,0.626},
  {"Sb",5.57,0.0,4.91},
  {"Te",5.80,0.0,4.7},
  {"I",5.28,0.0,6.15},
  {"Xe",4.92,0.0,23.9},
  {"Cs",5.42,0.0,29.0},
  {"Ba",5.07,0.0,1.1},
  {"La",8.24,0.0,8.97},
  {"Ce",4.84,0.0,0.63},
  {"Pr",4.58,0.0,11.5},
  {"Nd",7.69,0.0,50.5},
  {"Pm",12.6,0.0,168.4},
  {"Sm",0.80,-1.65,5922.},
  {"Eu",7.22,-1.26,4530.},
  {"Gd",6.5,-13.82,49700.},
  {"Tb",7.38,0.0,23.4},
  {"Dy",16.9,-0.276,994.},
  {"Ho",8.01,0.0,64.7},
  {"Er",7.79,0.0,159.},
  {"Tm",7.07,0.0,100.},
  {"Yb",12.43,0.0,34.8},
  {"Lu",7.21,0.0,74.},
  {"Hf",7.7,0.0,104.1},
  {"Ta",6.91,0.0,20.6},
  {"W",4.86,0.0,18.3},
  {"Re",9.2,0.0,89.7},
  {"Os",10.7,0.0,16},
  {"Ir",10.6,0.0,425.},
  {"Pt",9.60,0.0,10.3},
  {"Au",7.63,0.0,98.65},
  {"Hg",12.692,0.0,372.3},
  {"Tl",8.776,0.0,3.43},
  {"Pb",9.405,0.0,0.171},
  {"Bi",8.532,0.0,0.0338},
  {"Th",10.31,0.0,7.37},
  {"U",8.417,0.0,7.57}};

/*
  SF_WK95_CAA contains the reformatted data found in

      ftp://wrzx02.rz.uni-wuerzburg.de/pub/local/Crystallography/sfac.dat

  File picked up Jul  4, 1995.
  File verified  Jun 11, 1996.

  Head of "index.txt" in same directory:

    New Analytical Scattering Factor Functions for Free Atoms and Ions
                        D. Waasmaier & A. Kirfel
                     Acta Cryst. A, 1995, in press
                              April, 1995

  Header of "sfac.dat":

    - Fitparameters of all atoms/ions (with the excepetion of O1-)
      from publication "New Analytical Scattering Factor Functions
      for Free Atoms and Ions", D. Waasmaier & A. Kirfel, Acta Cryst.
      A 1995, in press)

    - Fit for O1- based on the tabulated values of Table 2 (D.REZ,
      P.REZ & I.GRANT, Acta Cryst. (1994), A50, 481-497).

    - Fits for all other atoms/ions based on the tabulated values
      of Table 6.1.1.1 (atoms) and Table 6.1.1.3 (ions)
      (International Tables for Crystallography, Vol. C, 1992).

  Current Contents:
    WAASMAIER D; KIRFEL A.
    NEW ANALYTICAL SCATTERING-FACTOR FUNCTIONS FOR FREE ATOMS AND IONS.
    ACTA CRYSTALLOGRAPHICA SECTION A, 1995 MAY 1, V51 MAY:416-431.
 */

const XRAY_SCAT_STRUCT95 XrayScatteringFactors95[NUMBER_OF_XRAY_SCATTERING_FACTORS95] =
{
  {"-",{0.0,0.0,0.0,0.0,0.0},{0.0,0.0,0.0,0.0,0.0},0.0},
  {"H",{0.413048,0.294953,0.187491,0.080701,0.023736},{15.569946,32.398468,5.711404,61.889874,1.334118},0.000049},
  {"D",{0.413048,0.294953,0.187491,0.080701,0.023736},{15.569946,32.398468,5.711404,61.889874,1.334118},0.000049},
  {"He",{0.732354,0.753896,0.283819,0.190003,0.039139},{11.553918,4.595831,1.546299,26.463964,0.377523},0.000487},
  {"Li",{0.974637,0.158472,0.811855,0.262416,0.790108},{4.334946,0.342451,97.102966,201.363831,1.409234},0.002542},
  {"Be",{1.533712,0.638283,0.601052,0.106139,1.118414},{42.662079,0.595420,99.106499,0.151340,1.843093},0.002511},
  {"B",{2.085185,1.064580,1.062788,0.140515,0.641784},{23.494068,1.137894,61.238976,0.114886,0.399036},0.003823},
  {"C",{2.657506,1.078079,1.490909,-4.241070,0.713791},{14.780758,0.776775,42.086842,-0.000294,0.239535},4.297983},
  {"N",{11.893780,3.277479,1.858092,0.858927,0.912985},{0.000158,10.232723,30.344690,0.656065,0.217287},-11.804902},
  {"O",{2.960427,2.508818,0.637853,0.722838,1.142756},{14.182259,5.936858,0.112726,34.958481,0.390240},0.027014},
  {"F",{3.511943,2.772244,0.678385,0.915159,1.089261},{10.687859,4.380466,0.093982,27.255203,0.313066},0.032557},
  {"Ne",{4.183749,2.905726,0.520513,1.135641,1.228065},{8.175457,3.252536,0.063295,21.813910,0.224952},0.025576},
  {"Na",{4.910127,3.081783,1.262067,1.098938,0.560991},{3.281434,9.119178,0.102763,132.013947,0.405878},0.079712},
  {"Mg",{4.708971,1.194814,1.558157,1.170413,3.239403},{4.875207,108.506081,0.111516,48.292408,1.928171},0.126842},
  {"Al",{4.730796,2.313951,1.541980,1.117564,3.154754},{3.628931,43.051167,0.095960,108.932388,1.555918},0.139509},
  {"Si",{5.275329,3.191038,1.511514,1.356849,2.519114},{2.631338,33.730728,0.081119,86.288643,1.170087},0.145073},
  {"P",{1.950541,4.146930,1.494560,1.522042,5.729711},{0.908139,27.044952,0.071280,67.520187,1.981173},0.155233},
  {"S",{6.372157,5.154568,1.473732,1.635073,1.209372},{1.514347,22.092527,0.061373,55.445175,0.646925},0.154722},
  {"Cl",{1.446071,6.870609,6.151801,1.750347,0.634168},{0.052357,1.193165,18.343416,46.398396,0.401005},0.146773},
  {"Ar",{7.188004,6.638454,0.454180,1.929593,1.523654},{0.956221,15.339877,15.339862,39.043823,0.062409},0.265954},
  {"K",{8.163991,7.146945,1.070140,0.877316,1.486434},{12.816323,0.808945,210.327011,39.597652,0.052821},0.253614},
  {"Ca",{8.593655,1.477324,1.436254,1.182839,7.113258},{10.460644,0.041891,81.390381,169.847839,0.688098},0.196255},
  {"Sc",{1.476566,1.487278,1.600187,9.177463,7.099750},{53.131023,0.035325,137.319489,9.098031,0.602102},0.157765},
  {"Ti",{9.818524,1.522646,1.703101,1.768774,7.082555},{8.001879,0.029763,39.885422,120.157997,0.532405},0.102473},
  {"V",{10.473575,1.547881,1.986381,1.865616,7.056250},{7.081940,0.026040,31.909672,108.022842,0.474882},0.067744},
  {"Cr",{11.007069,1.555477,2.985293,1.347855,7.034779},{6.366281,0.023987,23.244839,105.774498,0.429369},0.065510},
  {"Mn",{11.709542,1.733414,2.673141,2.023368,7.003180},{5.597120,0.017800,21.788420,89.517914,0.383054},-0.147293},
  {"Fe",{12.311098,1.876623,3.066177,2.070451,6.975185},{5.009415,0.014461,18.743040,82.767876,0.346506},-0.304931},
  {"Co",{12.914510,2.481908,3.466894,2.106351,6.960892},{4.507138,0.009126,16.438129,76.987320,0.314418},-0.936572},
  {"Ni",{13.521865,6.947285,3.866028,2.135900,4.284731},{4.077277,0.286763,14.622634,71.966080,0.004437},-2.762697},
  {"Cu",{14.014192,4.784577,5.056806,1.457971,6.932996},{3.738280,0.003744,13.034982,72.554794,0.265666},-3.254477},
  {"Zn",{14.741002,6.907748,4.642337,2.191766,38.424042},{3.388232,0.243315,11.903689,63.312130,0.000397},-36.915829},
  {"Ga",{15.758946,6.841123,4.121016,2.714681,2.395246},{3.121754,0.226057,12.482196,66.203621,0.007238},-0.847395},
  {"Ge",{16.540613,1.567900,3.727829,3.345098,6.785079},{2.866618,0.012198,13.432163,58.866047,0.210974},0.018726},
  {"As",{17.025642,4.503441,3.715904,3.937200,6.790175},{2.597739,0.003012,14.272119,50.437996,0.193015},-2.984117},
  {"Se",{17.354071,4.653248,4.259489,4.136455,6.749163},{2.349787,0.002550,15.579460,45.181202,0.177432},-3.160982},
  {"Br",{17.550570,5.411882,3.937180,3.880645,6.707793},{2.119226,16.557184,0.002481,42.164009,0.162121},-2.492088},
  {"Kr",{17.655279,6.848105,4.171004,3.446760,6.685200},{1.908231,16.606236,0.001598,39.917473,0.146896},-2.810592},
  {"Rb",{8.123134,2.138042,6.761702,1.156051,17.679546},{15.142385,33.542667,0.129372,224.132507,1.713368},1.139548},
  {"Sr",{17.730219,9.795867,6.099763,2.620025,0.600053},{1.563060,14.310868,0.120574,135.771317,0.120574},1.140251},
  {"Y",{17.792040,10.253252,5.714949,3.170516,0.918251},{1.429691,13.132816,0.112173,108.197029,0.112173},1.131787},
  {"Zr",{17.859772,10.911038,5.821115,3.512513,0.746965},{1.310692,12.319285,0.104353,91.777542,0.104353},1.124859},
  {"Nb",{17.958399,12.063054,5.007015,3.287667,1.531019},{1.211590,12.246687,0.098615,75.011948,0.098615},1.123452},
  {"Mo",{6.236218,17.987711,12.973127,3.451426,0.210899},{0.090780,1.108310,11.468720,66.684151,0.090780},1.108770},
  {"Tc",{17.840963,3.428236,1.373012,12.947364,6.335469},{1.005729,41.901382,119.320541,9.781542,0.083391},1.074784},
  {"Ru",{6.271624,17.906738,14.123269,3.746008,0.908235},{0.077040,0.928222,9.555345,35.860680,123.552246},1.043992},
  {"Rh",{6.216648,17.919739,3.854252,0.840326,15.173498},{0.070789,0.856121,33.889484,121.686691,9.029517},0.995452},
  {"Pd",{6.121511,4.784063,16.631683,4.318258,13.246773},{0.062549,0.784031,8.751391,34.489983,0.784031},0.883099},
  {"Ag",{6.073874,17.155437,4.173344,0.852238,17.988686},{0.055333,7.896512,28.443739,110.376106,0.716809},0.756603},
  {"Cd",{6.080986,18.019468,4.018197,1.303510,17.974669},{0.048990,7.273646,29.119284,95.831207,0.661231},0.603504},
  {"In",{6.196477,18.816183,4.050479,1.638929,17.962912},{0.042072,6.695665,31.009790,103.284348,0.610714},0.333097},
  {"Sn",{19.325171,6.281571,4.498866,1.856934,17.917318},{6.118104,0.036915,32.529045,95.037186,0.565651},0.119024},
  {"Sb",{5.394956,6.549570,19.650681,1.827820,17.867832},{33.326523,0.030974,5.564929,87.130966,0.523992},-0.290506},
  {"Te",{6.660302,6.940756,19.847015,1.557175,17.802427},{33.031654,0.025750,5.065547,84.101616,0.487660},-0.806668},
  {"I",{19.884502,6.736593,8.110516,1.170953,17.548716},{4.628591,0.027754,31.849096,84.406387,0.463550},-0.448811},
  {"Xe",{19.978920,11.774945,9.332182,1.244749,17.737501},{4.143356,0.010142,28.796200,75.280685,0.413616},-6.065902},
  {"Cs",{17.418674,8.314444,10.323193,1.383834,19.876251},{0.399828,0.016872,25.605827,233.339676,3.826915},-2.322802},
  {"Ba",{19.747343,17.368477,10.465718,2.592602,11.003653},{3.481823,0.371224,21.226641,173.834274,0.010719},-5.183497},
  {"La",{19.966019,27.329655,11.018425,3.086696,17.335455},{3.197408,0.003446,19.955492,141.381973,0.341817},-21.745489},
  {"Ce",{17.355122,43.988499,20.546650,3.130670,11.353665},{0.328369,0.002047,3.088196,134.907654,18.832960},-38.386017},
  {"Pr",{21.551311,17.161730,11.903859,2.679103,9.564197},{2.995675,0.312491,17.716705,152.192825,0.010468},-3.871068},
  {"Nd",{17.331244,62.783924,12.160097,2.663483,22.239950},{0.300269,0.001320,17.026001,148.748993,2.910268},-57.189842},
  {"Pm",{17.286388,51.560162,12.478557,2.675515,22.960947},{0.286620,0.001550,16.223755,143.984512,2.796480},-45.973682},
  {"Sm",{23.700363,23.072214,12.777782,2.684217,17.204367},{2.689539,0.003491,15.495437,139.862473,0.274536},-17.452166},
  {"Eu",{17.186195,37.156837,13.103387,2.707246,24.419271},{0.261678,0.001995,14.787360,134.816299,2.581883},-31.586687},
  {"Gd",{24.898117,17.104952,13.222581,3.266152,48.995213},{2.435028,0.246961,13.996325,110.863091,0.001383},-43.505684},
  {"Tb",{25.910013,32.344139,13.765117,2.751404,17.064405},{2.373912,0.002034,13.481969,125.836510,0.236916},-26.851971},
  {"Dy",{26.671785,88.687576,14.065445,2.768497,17.067781},{2.282593,0.000665,12.920230,121.937187,0.225531},-83.279831},
  {"Ho",{27.150190,16.999819,14.059334,3.386979,46.546471},{2.169660,0.215414,12.213148,100.506783,0.001211},-41.165253},
  {"Er",{28.174887,82.493271,14.624002,2.802756,17.018515},{2.120995,0.000640,11.915256,114.529938,0.207519},-77.135223},
  {"Tm",{28.925894,76.173798,14.904704,2.814812,16.998117},{2.046203,0.000656,11.465375,111.411980,0.199376},-70.839813},
  {"Yb",{29.676760,65.624069,15.160854,2.830288,16.997850},{1.977630,0.000720,11.044622,108.139153,0.192110},-60.313812},
  {"Lu",{30.122866,15.099346,56.314899,3.540980,16.943729},{1.883090,10.342764,0.000780,89.559250,0.183849},-51.049416},
  {"Hf",{30.617033,15.145351,54.933548,4.096253,16.896156},{1.795613,9.934469,0.000739,76.189705,0.175914},-49.719837},
  {"Ta",{31.066359,15.341823,49.278297,4.577665,16.828321},{1.708732,9.618455,0.000760,66.346199,0.168002},-44.119026},
  {"W",{31.507900,15.682498,37.960129,4.885509,16.792112},{1.629485,9.446448,0.000898,59.980675,0.160798},-32.864574},
  {"Re",{31.888456,16.117104,42.390297,5.211669,16.767591},{1.549238,9.233474,0.000689,54.516373,0.152815},-37.412682},
  {"Os",{32.210297,16.678440,48.559906,5.455839,16.735533},{1.473531,9.049695,0.000519,50.210201,0.145771},-43.677956},
  {"Ir",{32.004436,1.975454,17.070105,15.939454,5.990003},{1.353767,81.014175,0.128093,7.661196,26.659403},4.018893},
  {"Pt",{31.273891,18.445440,17.063745,5.555933,1.575270},{1.316992,8.797154,0.124741,40.177994,1.316997},4.050394},
  {"Au",{16.777390,19.317156,32.979683,5.595453,10.576854},{0.122737,8.621570,1.256902,38.008820,0.000601},-6.279078},
  {"Hg",{16.839890,20.023823,28.428564,5.881564,4.714706},{0.115905,8.256927,1.195250,39.247227,1.195250},4.076478},
  {"Tl",{16.630795,19.386616,32.808571,1.747191,6.356862},{0.110704,7.181401,1.119730,90.660263,26.014978},4.066939},
  {"Pb",{16.419567,32.738590,6.530247,2.342742,19.916475},{0.105499,1.055049,25.025890,80.906593,6.664449},4.049824},
  {"Bi",{16.282274,32.725136,6.678302,2.694750,20.576559},{0.101180,1.002287,25.714146,77.057549,6.291882},4.040914},
  {"Po",{16.289164,32.807171,21.095163,2.505901,7.254589},{0.098121,0.966265,6.046622,76.598068,28.096128},4.046556},
  {"At",{16.011461,32.615547,8.113899,2.884082,21.377867},{0.092639,0.904416,26.543257,68.372963,5.499512},3.995684},
  {"Rn",{16.070229,32.641106,21.489658,2.299218,9.480184},{0.090437,0.876409,5.239687,69.188477,27.632641},4.020977},
  {"Fr",{16.007385,32.663830,21.594351,1.598497,11.121192},{0.087031,0.840187,4.954467,199.805801,26.905106},4.003472},
  {"Ra",{32.563690,21.396671,11.298093,2.834688,15.914965},{0.801980,4.590666,22.758972,160.404388,0.083544},3.981773},
  {"Ac",{15.914053,32.535042,21.553976,11.433394,3.612409},{0.080511,0.770669,4.352206,21.381622,130.500748},3.939212},
  {"Th",{15.784024,32.454899,21.849222,4.239077,11.736191},{0.077067,0.735137,4.097976,109.464111,20.512138},3.922533},
  {"Pa",{32.740208,21.973675,12.957398,3.683832,15.744058},{0.709545,4.050881,19.231543,117.255005,0.074040},3.886066},
  {"U",{15.679275,32.824306,13.660459,3.687261,22.279434},{0.071206,0.681177,18.236156,112.500038,3.930325},3.854444},
  {"Np",{32.999901,22.638077,14.219973,3.672950,15.683245},{0.657086,3.854918,17.435474,109.464485,0.068033},3.769391},
  {"Pu",{33.281178,23.148544,15.153755,3.031492,15.704215},{0.634999,3.856168,16.849735,121.292038,0.064857},3.664200},
  {"Am",{33.435162,23.657259,15.576339,3.027023,15.746100},{0.612785,3.792942,16.195778,117.757004,0.061755},3.541160},
  {"Cm",{15.804837,33.480801,24.150198,3.655563,15.499866},{0.058619,0.590160,3.674720,100.736191,15.408296},3.390840},
  {"Bk",{15.889072,33.625286,24.710381,3.707139,15.839268},{0.055503,0.569571,3.615472,97.694786,14.754303},3.213169},
  {"Cf",{33.794075,25.467693,16.048487,3.657525,16.008982},{0.550447,3.581973,14.357388,96.064972,0.052450},3.005326},
  {"H1-",{0.702260,0.763666,0.248678,0.261323,0.023017},{23.945604,74.897919,6.773289,233.583450,1.337531},0.000425},
  {"Li1+",{0.432724,0.549257,0.376575,-0.336481,0.976060},{0.260367,1.042836,7.885294,0.260368,3.042539},0.001764},
  {"Be2+",{3.055430,-2.372617,1.044914,0.544233,0.381737},{0.001226,0.001227,1.542106,0.456279,4.047479},-0.653773},
  {"Cval",{1.258489,0.728215,1.119856,2.168133,0.705239},{10.683769,0.208177,0.836097,24.603704,58.954273},0.019722},
  {"O1-",{3.106934,3.235142,1.148886,0.783981,0.676953},{19.868080,6.960252,0.170043,65.693512,0.630757},0.046136},
  {"O2-",{3.990247,2.300563,0.607200,1.907882,1.167080},{16.639956,5.636819,0.108493,47.299709,0.379984},0.025429},
  {"F1-",{0.457649,3.841561,1.432771,0.801876,3.395041},{0.917243,5.507803,0.164955,51.076206,15.821679},0.069525},
  {"Na1+",{3.148690,4.073989,0.767888,0.995612,0.968249},{2.594987,6.046925,0.070139,14.122657,0.217037},0.045300},
  {"Mg2+",{3.062918,4.135106,0.853742,1.036792,0.852520},{2.015803,4.417941,0.065307,9.669710,0.187818},0.058851},
  {"Al3+",{4.132015,0.912049,1.102425,0.614876,3.219136},{3.528641,7.378344,0.133708,0.039065,1.644728},0.019397},
  {"Sival",{2.879033,3.072960,1.515981,1.390030,4.995051},{1.239713,38.706276,0.081481,93.616333,2.770293},0.146030},
  {"Si4+",{3.676722,3.828496,1.258033,0.419024,0.720421},{1.446851,3.013144,0.064397,0.206254,5.970222},0.097266},
  {"Cl1-",{1.061802,7.139886,6.524271,2.355626,35.829403},{0.144727,1.171795,19.467655,60.320301,0.000436},-34.916603},
  {"K1+",{-17.609339,1.494873,7.150305,10.899569,15.808228},{18.840979,0.053453,0.812940,22.264105,14.351593},0.257164},
  {"Ca2+",{8.501441,12.880483,9.765095,7.156669,0.711160},{10.525848,-0.004033,0.010692,0.684443,27.231771},-21.013187},
  {"Sc3+",{7.104348,1.511488,-53.669773,38.404816,24.532240},{0.601957,0.033386,12.572138,10.859736,14.125230},0.118642},
  {"Ti2+",{7.040119,1.496285,9.657304,0.006534,1.649561},{0.537072,0.031914,8.009958,201.800293,24.039482},0.150362},
  {"Ti3+",{36.587933,7.230255,-9.086077,2.084594,17.294008},{0.000681,0.522262,5.262317,15.881716,6.149805},-35.111282},
  {"Ti4+",{45.355537,7.092900,7.483858,-43.498817,1.678915},{9.252186,0.523046,13.082852,10.193876,0.023064},-0.110628},
  {"V2+",{7.754356,2.064100,2.576998,2.011404,7.126177},{7.066315,0.014993,7.066308,22.055786,0.467568},-0.533379},
  {"V3+",{9.958480,1.596350,1.483442,-10.846044,17.332867},{6.763041,0.056895,17.750029,0.328826,0.388013},0.474921},
  {"V5+",{15.575018,8.448095,1.612040,-9.721855,1.534029},{0.682708,5.566640,10.527077,0.907961,0.066667},0.552676},
  {"Cr2+",{10.598877,1.565858,2.728280,0.098064,6.959321},{6.151846,0.023519,17.432816,54.002388,0.426301},0.049870},
  {"Cr3+",{7.989310,1.765079,2.627125,1.829380,6.980908},{6.068867,0.018342,6.068887,16.309284,0.420864},-0.192123},
  {"Mn2+",{11.287712,26.042414,3.058096,0.090258,7.088306},{5.506225,0.000774,16.158575,54.766354,0.375580},-24.566132},
  {"Mn3+",{6.926972,2.081342,11.128379,2.375107,-0.419287},{0.378315,0.015054,5.379957,14.429586,0.004939},-0.093713},
  {"Mn4+",{12.409131,7.466993,1.809947,-12.138477,10.780248},{0.300400,0.112814,12.520756,0.168653,5.173237},0.672146},
  {"Fe2+",{11.776765,11.165097,3.533495,0.165345,7.036932},{4.912232,0.001748,14.166556,42.381958,0.341324},-9.676919},
  {"Fe3+",{9.721638,63.403847,2.141347,2.629274,7.033846},{4.869297,0.000293,4.867602,13.539076,0.338520},-61.930725},
  {"Co2+",{6.993840,26.285812,12.254289,0.246114,4.017407},{0.310779,0.000684,4.400528,35.741447,12.536393},-24.796852},
  {"Co3+",{6.861739,2.678570,12.281889,3.501741,-0.179384},{0.309794,0.008142,4.331703,11.914167,11.914167},-1.147345},
  {"Ni2+",{12.519017,37.832058,4.387257,0.661552,6.949072},{3.933053,0.000442,10.449184,23.860998,0.283723},-36.344471},
  {"Ni3+",{13.579366,1.902844,12.859268,3.811005,-6.838595},{0.313140,0.012621,3.906407,10.894311,0.344379},-0.317618},
  {"Cu1+",{12.960763,16.342150,1.110102,5.520682,6.915452},{3.576010,0.000975,29.523218,10.114283,0.261326},-14.849320},
  {"Cu2+",{11.895569,16.344978,5.799817,1.048804,6.789088},{3.378519,0.000924,8.133653,20.526524,0.254741},-14.878383},
  {"Zn2+",{13.340772,10.428857,5.544489,0.762295,6.869172},{3.215913,0.001413,8.542680,21.891756,0.239215},-8.945248},
  {"Ga3+",{13.123875,35.288189,6.126979,0.611551,6.724807},{2.809960,0.000323,6.831534,16.784311,0.212002},-33.875122},
  {"Ge4+",{6.876636,6.779091,9.969591,3.135857,0.152389},{2.025174,0.176650,3.573822,7.685848,16.677574},1.086542},
  {"Br1-",{17.714310,6.466926,6.947385,4.402674,-0.697279},{2.122554,19.050768,0.152708,58.690361,58.690372},1.152674},
  {"Rb1+",{17.684320,7.761588,6.680874,2.668883,0.070974},{1.710209,14.919863,0.128542,31.654478,0.128543},1.133263},
  {"Sr2+",{17.694973,1.275762,6.154252,9.234786,0.515995},{1.550888,30.133041,0.118774,13.821799,0.118774},1.125309},
  {"Y3+",{46.660366,10.369686,4.623042,-62.170834,17.471146},{-0.019971,13.180257,0.176398,-0.016727,1.467348},19.023842},
  {"Zr4+",{6.802956,17.699253,10.650647,-0.248108,0.250338},{0.096228,1.296127,11.240715,-0.219259,-0.219021},0.827902},
  {"Nb3+",{17.714323,1.675213,7.483963,8.322464,11.143573},{1.172419,30.102791,0.080255,-0.002983,10.456687},-8.339573},
  {"Nb5+",{17.580206,7.633277,10.793497,0.180884,67.837921},{1.165852,0.078558,9.507652,31.621656,-0.000438},-68.024780},
  {"Mo3+",{7.447050,17.778122,11.886068,1.997905,1.789626},{0.072000,1.073145,9.834720,28.221746,-0.011674},-1.898764},
  {"Mo5+",{7.929879,17.667669,11.515987,0.500402,77.444084},{0.068856,1.068064,9.046229,26.558945,-0.000473},-78.056595},
  {"Mo6+",{34.757683,9.653037,6.584769,-18.628115,2.490594},{1.301770,7.123843,0.094097,1.617443,12.335434},1.141916},
  {"Ru3+",{17.894758,13.579529,10.729251,2.474095,48.227997},{0.902827,8.740579,0.045125,24.764954,-0.001699},-51.905243},
  {"Ru4+",{17.845776,13.455084,10.229087,1.653524,14.059795},{0.901070,8.482392,0.045972,23.015272,-0.004889},-17.241762},
  {"Rh3+",{17.758621,14.569813,5.298320,2.533579,0.879753},{0.841779,8.319533,0.069050,23.709131,0.069050},0.960843},
  {"Rh4+",{17.716188,14.446654,5.185801,1.703448,0.989992},{0.840572,8.100647,0.068995,22.357307,0.068995},0.959941},
  {"Pd2+",{6.122282,15.651012,3.513508,9.060790,8.771199},{0.062424,8.018296,24.784275,0.776457,0.776457},0.879336},
  {"Pd4+",{6.152421,-96.069023,31.622141,81.578255,17.801403},{0.063951,11.090354,13.466152,9.758302,0.783014},0.915874},
  {"Ag1+",{6.091192,4.019526,16.948174,4.258638,13.889437},{0.056305,0.719340,7.758938,27.368349,0.719340},0.785127},
  {"Ag2+",{6.401808,48.699802,4.799859,-32.332523,16.356710},{0.068167,0.942270,20.639496,1.100365,6.883131},1.068247},
  {"Cd2+",{6.093711,43.909691,17.041306,-39.675117,17.958918},{0.050624,8.654143,15.621396,11.082067,0.667591},0.664795},
  {"In3+",{6.206277,18.497746,3.078131,10.524613,7.401234},{0.041357,6.605563,18.792250,0.608082,0.608082},0.293677},
  {"Sn2+",{6.353672,4.770377,14.672025,4.235959,18.002131},{0.034720,6.167891,6.167879,29.006456,0.561774},-0.042519},
  {"Sn4+",{15.445732,6.420892,4.562980,1.713385,18.033537},{6.280898,0.033144,6.280899,17.983601,0.557980},-0.172219},
  {"Sb3+",{10.189171,57.461918,19.356573,4.862206,-45.394096},{0.089485,0.375256,5.357987,22.153736,0.297768},1.516108},
  {"Sb5+",{17.920622,6.647932,12.724075,1.555545,7.600591},{0.522315,0.029487,5.718210,16.433775,5.718204},-0.445371},
  {"I1-",{20.010330,17.835524,8.104130,2.231118,9.158548},{4.565931,0.444266,32.430672,95.149040,0.014906},-3.341004},
  {"Cs1+",{19.939056,24.967621,10.375884,0.454243,17.660248},{3.770511,0.004040,25.311275,76.537766,0.384730},-19.394306},
  {"Ba2+",{19.750200,17.513683,10.884892,0.321585,65.149834},{3.430748,0.361590,21.358307,70.309402,0.001418},-59.618172},
  {"La3+",{19.688887,17.345703,11.356296,0.099418,82.358124},{3.146211,0.339586,18.753832,90.345459,0.001072},-76.846909},
  {"Ce3+",{26.593231,85.866432,-6.677695,12.111847,17.401903},{3.280381,0.001012,4.313575,17.868504,0.326962},-80.313423},
  {"Ce4+",{17.457533,25.659941,11.691037,19.695251,-16.994749},{0.311812,-0.003793,16.568687,2.886395,-0.008931},-3.515096},
  {"Pr3+",{20.879841,36.035797,12.135341,0.283103,17.167803},{2.870897,0.002364,16.615236,53.909359,0.306993},-30.500784},
  {"Pr4+",{17.496082,21.538509,20.403114,12.062211,-7.492043},{0.294457,-0.002742,2.772886,15.804613,-0.013556},-9.016722},
  {"Nd3+",{17.120077,56.038139,21.468307,10.000671,2.905866},{0.291295,0.001421,2.743681,14.581367,22.485098},-50.541992},
  {"Pm3+",{22.221066,17.068142,12.805423,0.435687,52.238770},{2.635767,0.277039,14.927315,45.768017,0.001455},-46.767181},
  {"Sm3+",{15.618565,19.538092,13.398946,-4.358811,24.490461},{0.006001,0.306379,14.979594,0.748825,2.454492},-9.714854},
  {"Eu2+",{23.899035,31.657497,12.955752,1.700576,16.992199},{2.467332,0.002230,13.625002,35.089481,0.253136},-26.204315},
  {"Eu3+",{17.758327,33.498665,24.067188,13.436883,-9.019134},{0.244474,-0.003901,2.487526,14.568011,-0.015628},-19.768026},
  {"Gd3+",{24.344999,16.945311,13.866931,0.481674,93.506378},{2.333971,0.239215,12.982995,43.876347,0.000673},-88.147179},
  {"Tb3+",{24.878252,16.856016,13.663937,1.279671,39.271294},{2.223301,0.227290,11.812528,29.910065,0.001527},-33.950317},
  {"Dy3+",{16.864344,90.383461,13.675473,1.687078,25.540651},{0.216275,0.000593,11.121207,26.250975,2.135930},-85.150650},
  {"Ho3+",{16.837524,63.221336,13.703766,2.061602,26.202621},{0.206873,0.000796,10.500283,24.031883,2.055060},-58.026505},
  {"Er3+",{16.810127,22.681061,13.864114,2.294506,26.864477},{0.198293,0.002126,9.973341,22.836388,1.979442},-17.513460},
  {"Tm3+",{16.787500,15.350905,14.182357,2.299111,27.573771},{0.190852,0.003036,9.602934,22.526880,1.912862},-10.192087},
  {"Yb2+",{28.443794,16.849527,14.165081,3.445311,28.308853},{1.863896,0.183811,9.225469,23.691355,0.001463},-23.214935},
  {"Yb3+",{28.191629,16.828087,14.167848,2.744962,23.171774},{1.842889,0.182788,9.045957,20.799847,0.001759},-18.103676},
  {"Lu3+",{28.828693,16.823227,14.247617,3.079559,25.647667},{1.776641,0.175560,8.575531,19.693701,0.001453},-20.626528},
  {"Hf4+",{29.267378,16.792543,14.785310,2.184128,23.791996},{1.697911,0.168313,8.190025,18.277578,0.001431},-18.820383},
  {"Ta5+",{29.539469,16.741854,15.182070,1.642916,16.437447},{1.612934,0.160460,7.654408,17.070732,0.001858},-11.542459},
  {"W6+",{29.729357,17.247808,15.184488,1.154652,0.739335},{1.501648,0.140803,6.880573,14.299601,14.299618},3.945157},
  {"Os4+",{17.113485,15.792370,23.342392,4.090271,7.671292},{0.131850,7.288542,1.389307,19.629425,1.389307},3.988390},
  {"Ir3+",{31.537575,16.363338,15.597141,5.051404,1.436935},{1.334144,7.451918,0.127514,21.705648,0.127515},4.009459},
  {"Ir4+",{30.391249,16.146996,17.019068,4.458904,0.975372},{1.328519,7.181766,0.127337,19.060146,1.328519},4.006865},
  {"Pt2+",{31.986849,17.249048,15.269374,5.760234,1.694079},{1.281143,7.625512,0.123571,24.190826,0.123571},4.032512},
  {"Pt4+",{41.932713,16.339224,17.653894,6.012420,-12.036877},{1.111409,6.466086,0.128917,16.954155,0.778721},4.094551},
  {"Au1+",{32.124306,16.716476,16.814100,7.311565,0.993064},{1.216073,7.165378,0.118715,20.442486,53.095985},4.040792},
  {"Au3+",{31.704271,17.545767,16.819551,5.522640,0.361725},{1.215561,7.220506,0.118812,20.050970,1.215562},4.042679},
  {"Hg1+",{28.866837,19.277540,16.776051,6.281459,3.710289},{1.173967,7.583842,0.115351,29.055994,1.173968},4.068430},
  {"Hg2+",{32.411079,18.690371,16.711773,9.974835,-3.847611},{1.162980,7.329806,0.114518,22.009489,22.009493},4.052869},
  {"Tl1+",{32.295044,16.570049,17.991013,1.535355,7.554591},{1.101544,0.110020,6.528559,52.495068,20.338634},4.054030},
  {"Tl3+",{32.525639,19.139185,17.100321,5.891115,12.599463},{1.094966,6.900992,0.103667,18.489614,-0.001401},-9.256075},
  {"Pb2+",{27.392647,16.496822,19.984501,6.813923,5.233910},{1.058874,0.106305,6.708123,24.395554,1.058874},4.065623},
  {"Pb4+",{32.505657,20.014240,14.645661,5.029499,1.760138},{1.047035,6.670321,0.105279,16.525040,0.105279},4.044678},
  {"Bi3+",{32.461437,19.438683,16.302486,7.322662,0.431704},{0.997930,6.038867,0.101338,18.371586,46.361046},4.043703},
  {"Bi5+",{16.734028,20.580494,9.452623,61.155834,-34.041023},{0.105076,4.773282,11.762162,1.211775,1.619408},4.113663},
  {"Ra2+",{4.986228,32.474945,21.947443,11.800013,10.807292},{0.082597,0.791468,4.608034,24.792431,0.082597},3.956572},
  {"Ac3+",{15.584983,32.022125,21.456327,0.757593,12.341252},{0.077438,0.739963,4.040735,47.525002,19.406845},3.838984},
  {"Th4+",{15.515445,32.090691,13.996399,12.918157,7.635514},{0.074499,0.711663,3.871044,18.596891,3.871044},3.831122},
  {"U3+",{15.360309,32.395657,21.961290,1.325894,14.251453},{0.067815,0.654643,3.643409,39.604965,16.330570},3.706622},
  {"U4+",{15.355091,32.235306,0.557745,14.396367,21.751173},{0.067789,0.652613,42.354237,15.908239,3.553231},3.705863},
  {"U6+",{15.333844,31.770849,21.274414,13.872636,0.048519},{0.067644,0.646384,3.317894,14.650250,75.339699},3.700591},
  {"Np3+",{15.378152,32.572132,22.206125,1.413295,14.828381},{0.064613,0.631420,3.561936,37.875511,15.546129},3.603370},
  {"Np4+",{15.373926,32.423019,21.969994,0.662078,14.969350},{0.064597,0.629658,3.476389,39.438942,15.135764},3.603039},
  {"Np6+",{15.359986,31.992825,21.412458,0.066574,14.568174},{0.064528,0.624505,3.253441,67.658318,13.980832},3.600942},
  {"Pu3+",{15.356004,32.769127,22.680210,1.351055,15.416232},{0.060590,0.604663,3.491509,37.260635,14.981921},3.428895},
  {"Pu4+",{15.416219,32.610569,22.256662,0.719495,15.518152},{0.061456,0.607938,3.411848,37.628792,14.464360},3.480408},
  {"Pu6+",{15.436506,32.289719,14.726737,15.012391,7.024677},{0.061815,0.606541,3.245363,13.616438,3.245364},3.502325}
};


REAL ScatteringFactor(int index,REAL stol2)
{
  int i;
  REAL  sf;

  sf=0.0;
  switch(Diffraction.Type)
  {
    case XRAY_DIFFRACTION:
      sf=XrayScatteringFactors95[index].c;
      for(i=0;i<5;i++)
        sf+=XrayScatteringFactors95[index].a[i]*exp(-XrayScatteringFactors95[index].b[i]*stol2);
      break;
    case ELECTRON_DIFFRACTION:
      sf=0.0;
      for(i=0;i<4;i++)
        sf+=ElectronScatteringFactors[index].a[i]*exp(-ElectronScatteringFactors[index].b[i]*stol2);
      break;
    case NEUTRON_DIFFRACTION:
      sf=NeutronScatteringFactors[index].BondCohScattLength;
    default:
      break;
  }

  return sf;
}

int GetScatteringNumber(char *Name)
{
  int i;

  if(strlen(Name)==0) return -1;

  switch(Diffraction.Type)
  {
    case XRAY_DIFFRACTION:
      for(i=0;i<NUMBER_OF_XRAY_SCATTERING_FACTORS95;i++)
      {
        if(strncasecmp(XrayScatteringFactors95[i].Label,Name,MAX2(strlen(XrayScatteringFactors95[i].Label),strlen(Name)))==0)
          return i;
      }
      break;
    case ELECTRON_DIFFRACTION:
      for(i=0;i<NUMBER_OF_ELECTRONIC_SCATTERING_FACTORS;i++)
      {
        if(strncasecmp(ElectronScatteringFactors[i].Label,Name,MAX2(strlen(ElectronScatteringFactors[i].Label),strlen(Name)))==0)
          return i;
      }
      break;
    case NEUTRON_DIFFRACTION:
      for(i=0;i<NUMBER_OF_NEUTRON_SCATTERING_FACTORS;i++)
      {
        if(strncasecmp(NeutronScatteringFactors[i].Label,Name,MAX2(strlen(NeutronScatteringFactors[i].Label),strlen(Name)))==0)
          return i;
      }
      break;
  }
  return -1;
}

int GetAnomalousScatteringNumber(char *Name)
{
  int i;

  for(i=0;i<NUMBER_OF_ANOMALOUS_SCATTERING_FACTORS;i++)
  {
    if(strncasecmp(AnomousScatteringFactors[i].Label,Name,strlen(Name))==0)
     return i;
  }
  return -1;
}

COMPLEX GetAnomalousScatteringFactor(int index)
{
  return AnomousScatteringFactors[index].ScatteringFactor[2];
}
